Files
EasySoft-ZenTaoPMS/test/class/gitlab.class.php
T
2022-08-05 08:26:59 +08:00

89 lines
1.7 KiB
PHP

<?php
class gitlabTest
{
public $tester;
public function __construct()
{
global $tester;
$this->tester = $tester;
$this->gitlab = $this->tester->loadModel('gitlab');
}
/**
* Get by id.
*
* @param int $id
* @access public
* @return object
*/
public function getByID($id)
{
$gitlab = $this->gitlab->getByID($id);
if(empty($gitlab)) return 0;
return $gitlab;
}
/**
* Get gitlab list.
*
* @param string $orderBy
* @access public
* @return object
*/
public function getList($orderBy = 'id_desc')
{
$gitlab = $this->gitlab->getList($orderBy);
if(empty($gitlab)) return 0;
return array_shift($gitlab);
}
/**
* Get gitlab pairs
*
* @return string
*/
public function getPairs()
{
$pairs = $this->gitlab->getPairs();
return key($pairs);
}
/**
* Create a gitlab.
*
* @access public
* @return object|string
*/
public function create()
{
$gitlabID = $this->gitlab->create();
if(dao::isError())
{
$errors = dao::getError();
return key($errors);
}
return $this->gitlab->getById($gitlabID);
}
/**
* Update a gitlab.
*
* @param int $id
* @access public
* @return object|string
*/
public function update($id)
{
$this->gitlab->update($id);
if(dao::isError())
{
$errors = dao::getError();
return key($errors);
}
return $this->gitlab->getById($id);
}
}