/**
  * @return Socket
  **/
 public function setPort($port)
 {
     Assert::isNull($this->port);
     $this->port = $port;
     return $this;
 }
 /**
  * @return LogLevel
  **/
 public function setId($id)
 {
     Assert::isNull($this->id, 'i am immutable one!');
     return parent::setId($id);
 }
Пример #3
0
 /**
  * undocumented function
  *
  * @return void
  * @access public
  */
 static function logout()
 {
     Configure::delete('User');
     Assert::isNull(Configure::read('User'));
     $Session = Common::getComponent('Session');
     $Session->del('User');
     $Cookie = Common::getComponent('Cookie');
     $Cookie->del('Auth.key');
     Assert::isEmpty($Cookie->read('Auth.key'));
     $Cookie->del('Auth.name');
     return true;
 }
 protected function call($method, DTOMessage $request, $resultClass)
 {
     $requestDto = $request->makeDto();
     Assert::isInstance($requestDto, 'DTOClass');
     if (defined('__LOCAL_DEBUG__') && !defined('SIMPLE_TEST')) {
         // self-validation
         $form = ObjectToFormConverter::create($request->entityProto())->make($request);
         Assert::isTrue(!$form->getErrors() && $request->entityProto()->validate($request, $form), Assert::dumpArgument($request));
     }
     try {
         try {
             $resultDto = $this->getSoapClient()->{$method}($requestDto);
         } catch (BaseException $e) {
             if (get_class($e) == 'BaseException') {
                 throw new SoapFault('Server', get_class($e) . ': ' . $e->getMessage());
             } else {
                 $this->logCall();
                 throw $e;
             }
         }
     } catch (SoapFault $e) {
         $this->logCall();
         throw self::convertSoapFault($e);
     }
     $this->logCall();
     if (!$resultClass) {
         Assert::isNull($resultDto);
         $result = null;
     } else {
         Assert::isInstance($resultDto, 'DTOClass');
         Assert::isEqual($resultDto->entityProto()->className(), $resultClass);
         $form = DTOToFormImporter::create($resultDto->entityProto())->make($resultDto);
         Assert::isTrue(!$form->getErrors(), Assert::dumpArgument($resultDto));
         $result = $resultDto->makeObject($form);
         Assert::isInstance($result, 'DTOMessage');
         Assert::isEqual(get_class($result), $resultClass);
         Assert::isTrue($result->entityProto()->validate($result, $form), Assert::dumpArgument($result));
     }
     return $result;
 }
 private function commentState()
 {
     Assert::isNull($this->tag);
     Assert::isNull($this->tagId);
     $content = $this->getComment();
     $this->tag = SgmlIgnoredTag::comment()->setCdata(Cdata::create()->setData($content));
     $this->makeTag();
     return self::INITIAL_STATE;
 }