Example #1
0
 public function testGlobals()
 {
     $this->assertInternalType('bool', \Packaged\Helpers\System::isHHVM());
     $this->assertInternalType('bool', \Packaged\Helpers\System::isMac());
     $this->assertInternalType('bool', \Packaged\Helpers\System::isWindows());
 }
Example #2
0
 /**
  * (PHP 5 &gt;= 5.4.0)<br/>
  * Specify data which should be serialized to JSON
  * @link http://php.net/manual/en/jsonserializable.jsonserialize.php
  * @return mixed data which can be serialized by <b>json_encode</b>,
  * which is a value of any type other than a resource.
  */
 public function jsonSerialize()
 {
     // HHVM does not json_encode
     if (System::isHHVM()) {
         $values = get_public_properties($this);
         foreach ($values as $k => $v) {
             if ($v instanceof \DateTime) {
                 $values[$k] = ['date' => $v->format('Y-m-d H:i:s'), 'timezone_type' => 1, 'timezone' => $v->format('O')];
             }
         }
         return $values;
     }
     return $this;
 }