Beispiel #1
0
 /**
  * Read data from the session dirver
  *
  * @param string		$id		The session id key.
  * @return array
  */
 public function read($id)
 {
     if ($this->has($id)) {
         return \CCJson::read($this->file_path($id));
     }
     return array();
 }
Beispiel #2
0
 /** 
  * create an new ship object from path
  *
  * @param string 		$path
  * @return CCOrbit_Ship
  */
 public static function create($path)
 {
     if (is_null($path)) {
         return new static();
     }
     // use the orbit path if we are relative
     if (substr($path, 0, 1) != '/') {
         $path = ORBITPATH . $path;
     }
     // check the path
     if (substr($path, -1) != '/') {
         $path .= '/';
     }
     $blueprint = $path . 'blueprint.json';
     if (!file_exists($blueprint)) {
         throw new CCException("CCOrbit_Ship::create - clould not find a blueprint at {$blueprint}.");
     }
     if (!($blueprint_data = CCJson::read($blueprint))) {
         throw new CCException("CCOrbit_Ship::create - invalid blueprint at {$blueprint}.");
     }
     return static::blueprint($blueprint_data, $path);
 }
Beispiel #3
0
 /**
  * Read the file and return the data
  *
  * @return array
  */
 protected function read_file($file)
 {
     return CCJson::read($file);
 }