/** * Get * Get Value based on Key * @param string $dataKey * @return mixed */ public function get($dataKey, $default = '[RAMLDataObject]') { if (!isset($this->data[$dataKey])) { $dataKey = strtoupper($dataKey); } if (!isset($this->data[$dataKey])) { if ($default != '[RAMLDataObject]') { return $default; } return new RAMLDataObject(); // shoudl return false } elseif (is_array($this->data[$dataKey])) { $t = new RAMLDataObject($this->data[$dataKey]); $t->setMaster($this->master); return $t; // convert to preg_match_all } elseif (is_string($this->data[$dataKey]) && preg_match('/^\\!include ([a-z_\\.\\/]+)/i', $this->data[$dataKey], $matches)) { $ext = array_pop(explode('.', $matches[1])); if (in_array($ext, array('yaml', 'raml'))) { $t = new RAMLDataObject(spyc_load_file($matches[1])); $t->setMaster($this); return $t; } return file_get_contents($matches[1]); } elseif ($dataKey == 'schema') { $this->data[$dataKey] = $this->master->handleSchema($this->data[$dataKey]); } return $this->master->handlePlaceHolders($this->data[$dataKey]); }
/** * Constructing Method * Setups class properties * @param array $verbs * @return void */ public function __construct($verbs = array()) { $this->setMaster($this); $this->verbs = $verbs; parent::__construct(); }
public function __construct($master, $path) { $this->master = $master; $this->path = $path; parent::__construct(); }