Exemple #1
0
 public function __construct(MObject $parent = null)
 {
     parent::__construct($parent);
     if (function_exists('pcntl_fork') === false) {
         throw new \Exception('You have to compile the CGI or CLI version of PHP with --enable-pcntl configuration option when compiling PHP to use MThread');
     }
 }
 /**
  * RequestBook constructor.
  */
 public function __construct()
 {
     parent::__construct();
     $this->filterBook = new FilterBook();
     $this->orderClauseBook = new OrderClauseBook();
     $this->paginationBook = new PaginationBook();
 }
 public function __construct(MObject $parent = null)
 {
     parent::__construct($parent);
     $this->lastError = new MSqlError();
 }
Exemple #4
0
 /**
  * @param \MToolkit\Core\MObject $parent
  */
 public function __construct(MObject $parent = null)
 {
     parent::__construct($parent);
 }
 public function __construct(MAbstractController $parent = null)
 {
     parent::__construct($parent);
     $this->httpResponse = new MHttpResponse();
 }
Exemple #6
0
 /**
  * @param mixed $obj1
  * @param mixed $obj2
  * @return boolean
  * @throws \Exception
  */
 public static function areEquals($obj1, $obj2)
 {
     if (gettype($obj1) != gettype($obj2)) {
         return false;
     }
     switch (gettype($obj1)) {
         case "boolean":
             return $obj1 === $obj2;
             break;
         case "integer":
         case "double":
         case "string":
             return $obj1 == $obj2;
             break;
         case "array":
             return count(array_diff($obj1, $obj2)) == 0;
             break;
         case "object":
             // Do nothing
             break;
         case "NULL":
             return true;
             break;
         default:
             throw new \Exception('Types like "resource" and "unknown type" are incomparable.');
             break;
     }
     if (get_class($obj1) != get_class($obj2)) {
         return false;
     }
     $reflectObj1 = new \ReflectionClass($obj1);
     $reflectObj2 = new \ReflectionClass($obj2);
     /* @var $propertiesThis \ReflectionProperty[] */
     $propertiesObj1 = $reflectObj1->getProperties();
     /* @var $propertiesObj \ReflectionProperty[] */
     $propertiesObj2 = $reflectObj2->getProperties();
     if (count($propertiesObj1) != count($propertiesObj2)) {
         return false;
     }
     for ($i = 0; $i < count($obj1); $i++) {
         /* @var $propertyObj1 \ReflectionProperty */
         $propertyObj1 = $propertiesObj1[$i];
         /* @var $propertyObj2 \ReflectionProperty */
         $propertyObj2 = $propertiesObj2[$i];
         $propertyObj1->setAccessible(true);
         $propertyObj2->setAccessible(true);
         $areEquals = MObject::areEquals($propertyObj1->getValue($obj1), $propertyObj2->getValue($obj2));
         if ($areEquals === false) {
             return false;
         }
     }
     return true;
 }
 public function __construct(MObject $parent = null)
 {
     parent::__construct($parent);
     $this->headers = new MHttpHeaders();
 }
Exemple #8
0
 public function equals(MVector $other)
 {
     if ($this->size() != $other->size()) {
         return false;
     }
     for ($k = 0; $k < $this->count(); $k++) {
         if (MObject::areEquals($this->at($k), $other->at($k)) === false) {
             return false;
         }
     }
     return true;
 }
 /**
  * Constructs an abstract controller with the given <i>$parent</i>.
  * 
  * @param MObject $parent
  */
 public function __construct(MObject $parent = null)
 {
     parent::__construct($parent);
     $this->httpResponse = new MHttpResponse();
     $this->controls = new MMap();
 }