Exemple #1
0
 private function hasRequiredProperties($theme)
 {
     $attributes = new ArrayFinder($theme->get(null));
     foreach ($this->getRequiredProperties() as $prop) {
         if (!$attributes->offsetExists($prop)) {
             return false;
         }
     }
     return true;
 }
 /**
  * Set an option for the data store
  * @param  {String}       a string in dot notation dictating where the option is in the data structure
  * @param  {Mixed}        the value for the key
  *
  * @return {Array}        the store
  */
 public static function setOption($key = "", $value = "")
 {
     if (empty($key)) {
         return false;
     }
     $arrayFinder = new ArrayFinder(self::$store);
     $arrayFinder->set($key, $value);
     self::$store = $arrayFinder->get();
 }
 public function testGetWithoutParamWillReturnAllTheArray()
 {
     $content = $this->arrayFinder->get();
     $this->assertEquals('end', $content['a']['b']['c']);
 }
 /**
  * Write out the new config option value
  * @param  {String}       the name of the option to be changed
  * @param  {String}       the new value of the option to be changed
  */
 protected static function writeUpdateConfigOption($optionName, $optionValue)
 {
     // parse the YAML options
     try {
         $options = Yaml::parse(file_get_contents(self::$userConfigPath));
     } catch (ParseException $e) {
         Console::writeError("Config parse error in <path>" . self::$userConfigPath . "</path>: " . $e->getMessage());
     }
     // set this option for the current running of the app
     self::setOption($optionName, $optionValue);
     // modify the yaml file results
     $arrayFinder = new ArrayFinder($options);
     $arrayFinder->set($optionName, $optionValue);
     $options = $arrayFinder->get();
     // dump the YAML
     $configOutput = Yaml::dump($options, 3);
     // write out the new config file
     file_put_contents(self::$userConfigPath, $configOutput);
 }