本文整理汇总了PHP中Service类的典型用法代码示例。如果您正苦于以下问题:PHP Service类的具体用法?PHP Service怎么用?PHP Service使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Service类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete_list
function delete_list($id)
{
if ($id) {
$rs = new Service($id);
$rs->delete();
}
}
示例2: getGroupMembers
/**
* Requires memberOf attribute.
*
* @static
* @param $ldapGroup
* @param $options
* @return User[]
*/
public static function getGroupMembers($ldapGroup, $options)
{
if ($options instanceof Service) {
$ldap = $options;
} else {
$ldap = new Service($options);
}
$filter = "(&(objectCategory=user)(memberOf={$ldapGroup}))";
$attributes = array('samaccountname', 'cn', 'givenname', 'sn', 'mail', 'title', 'department', 'memberof');
$results = $ldap->search($filter, $attributes);
$users = array();
foreach ($results as $row) {
$users[] = new User($row);
}
// sort by name TODO use $options to change comparison property
usort($users, function ($a, $b) {
$al = strtolower($a->getName());
$bl = strtolower($b->getName());
if ($al == $bl) {
return 0;
}
return $al > $bl ? +1 : -1;
});
return $users;
}
示例3: loadRoutesFromService
/**
* Loads the routs fromm the api endpoint and stores them locally.
*/
public function loadRoutesFromService()
{
$service = new Service('endpoints');
$service->routes(array('list' => array('path' => '/api/endpoints', 'method' => 'GET')));
$this->_routeList = $service->list();
$this->cacheRoutes();
}
示例4: addService
private function addService()
{
if ($this->requestParameter['submit']) {
$objService = new Service();
$objServiceValidator = NCConfigFactory::getInstance()->getServiceValidator();
$objService->setServiceId($this->requestParameter['serviceId']);
$objService->setServerId($this->requestParameter['serverId']);
$objService->setServiceTypeId($this->requestParameter['serviceTypeId']);
$objService->setServicePort($this->requestParameter['servicePort']);
$objService->setServiceDNS($this->requestParameter['serviceDNS']);
$objService->setServiceDNS2($this->requestParameter['serviceDNS2']);
$objService->setServiceDNS3($this->requestParameter['serviceDNS3']);
$objService->setServiceRefName($this->requestParameter['serviceRefName']);
if ($this->requestParameter['serviceId']) {
$errorArray = $objServiceValidator->editValidation($objService);
if ($errorArray) {
$errorArray['error'] = 'ERROR';
echo json_encode($errorArray);
} else {
$this->objServiceManager->editService($objService);
echo json_encode(array('serviceId' => $this->requestParameter['serviceId']));
}
} else {
$errorArray = $objServiceValidator->addValidation($objService);
if ($errorArray) {
$errorArray['error'] = 'ERROR';
echo json_encode($errorArray);
} else {
$serviceId = $this->objServiceManager->addService($objService);
echo json_encode(array('serviceId' => $serviceId));
}
}
}
}
示例5: Decode
public function Decode($buf = '')
{
$this->buffer = new CodeEngine($buf);
$this->ResultID = $this->buffer->DecodeInt16();
$this->Uin = $this->buffer->DecodeInt32();
if ($this->ResultID == CSResultID::result_id_success) {
$temp1 = new PlayerCommonInfo();
$temp1->Decode($this->buffer);
$this->BaseInfo = $temp1;
$this->ServiceData->Count = $this->buffer->DecodeInt16();
for ($i = 0; $i < $this->ServiceData->Count; $i++) {
$temp2 = new Service();
$temp2->Decode($this->buffer);
$this->ServiceData->Service[] = $temp2;
}
$this->LockType = $this->buffer->DecodeInt16();
$this->GameID = $this->buffer->DecodeInt16();
$this->LockedServerType = $this->buffer->DecodeInt16();
$this->LockedServerID = $this->buffer->DecodeInt32();
$this->LockedRoomID = $this->buffer->DecodeInt32();
$this->LockedTableID = $this->buffer->DecodeInt32();
$this->LockMoney = $this->buffer->DecodeInt32();
$this->HappyBeanLockType = $this->buffer->DecodeInt16();
$this->HappyBeanGameID = $this->buffer->DecodeInt16();
$this->HappyBeanLockedServerType = $this->buffer->DecodeInt16();
$this->HappyBeanLockedServerID = $this->buffer->DecodeInt32();
$this->HappyBeanLockedRoomID = $this->buffer->DecodeInt32();
$this->HappyBeanLockedTableID = $this->buffer->DecodeInt32();
}
return $this;
}
示例6: save
/**
* Updates or inserts a contact
* @param Service $service
* @return self
* @throws NotValidException
*/
public function save(Service $service)
{
if (!$this->validate()) {
throw new NotValidException('Unable to validate contact');
}
return $this->reload($service->save($this));
}
示例7: get
public function get($customerId = null, $carId = null)
{
$sql = "SELECT * FROM {$this->tableName} WHERE 1=1";
if (!empty($customerId)) {
$sql .= " AND `owner` = " . $this->db->escape($customerId);
}
if (!empty($carId)) {
$sql .= " AND `id` = " . $this->db->escape($carId);
}
$result = array();
$service = new Service();
if (!empty($carId)) {
$result = $this->db->fetchOne($sql);
$customer = new Customer(false);
$owner = $customer->get($result['owner']);
if (!empty($owner)) {
$result['owner'] = $owner;
}
$result['services'] = $service->getForCar($carId);
} else {
$result = $this->db->fetchAll($sql);
$customer = new Customer(false);
foreach ($result as $index => $car) {
$owner = $customer->get($car['owner']);
if (!empty($owner)) {
$result[$index]['owner'] = $owner;
}
$result[$index]['services'] = $service->getForCar($car['id']);
}
}
new Respond($result);
}
示例8: __construct
public function __construct(Service $service)
{
$this->db = $db;
//Выборка всех категорий для меню т.к. используются на всех страницах публичной части
$this->category = $service->get('category_mapper')->getAll();
$this->basket_info = Basket::getBasketInfo();
}
示例9: getContact
/**
* Get contacts from a given source
* @param integer $idSource
* @param integer|bool $page
* @return bool|Response
*/
public function getContact($idSource, $page = false)
{
if ($page && is_numeric($page)) {
$page = '?page=' . $page;
}
return $this->service->setRequestPath('origin/' . $idSource . '/contact' . $page)->setRequestType(Service::REQUEST_METHOD_GET)->request();
}
示例10: _start
/**
* SetUp
*/
protected function _start()
{
$this->table = Doctrine::getTable('OperationNotification');
// Создать услугу с захардкоженным ID
$service = new Service();
$service->setKeyword(Service::SERVICE_SMS);
$service->save();
}
示例11: change_template
public function change_template()
{
App::import('Model', 'Service');
$mService = new Service();
$service = $mService->find('first', array('conditions' => array('Service.id' => $this->request->data['idService'])));
echo json_encode($service['Service']);
die;
}
示例12: testSetAndGetParam
/**
* @covers \Request\Service::setParam
* @covers \Request\Service::getParams
* @depends testCreateService
*/
public function testSetAndGetParam()
{
$testKey = 'testKey';
$request = new Service();
$request->setParam($testKey, 'value');
$params = $request->getParams();
$this->assertEquals('value', $params[$testKey]);
}
示例13: testShouldDefineServiceWithSetterInjection
public function testShouldDefineServiceWithSetterInjection()
{
$this->app->set('commonService', function (Container $di) {
$service = new Service($di->get('component'));
$service->setFormat('xml');
return $service;
});
$service = $this->app->get('commonService');
$this->assertEquals('xml', $service->getFormat());
}
示例14: testShouldDefineServiceWithSetterInjection
public function testShouldDefineServiceWithSetterInjection()
{
$this->app->commonService = function (Application $app) {
$service = new Service($app->component);
$service->setFormat('xml');
return $service;
};
$service = $this->app->commonService;
$this->assertEquals('xml', $service->getFormat());
}
示例15: createParser
/**
* Applies the listeners needed to parse client models.
*
* @param Service $api API to create a parser for
*
* @return callable
*
* @throws \UnexpectedValueException
*/
public static function createParser(Service $api)
{
static $mapping = ['json' => 'Vws\\Api\\Parser\\JsonRpcParser', 'rest-json' => 'Vws\\Api\\Parser\\RestJsonParser'];
$proto = $api->getProtocol();
if (isset($mapping[$proto])) {
return new $mapping[$proto]($api);
} else {
throw new \UnexpectedValueException('Unknown protocol: ' . $api->getProtocol());
}
}