예제 #1
0
파일: Compiler.php 프로젝트: solve/slot
 /**
  * Set config value partially of completely
  * @param $name
  * @param $value
  * @return $this
  */
 public function setConfig($name, $value)
 {
     if (is_null($name)) {
         $this->_config = new ArrayStorage($value);
     } else {
         $this->_config->setDeepValue($name, $value);
     }
     return $this;
 }
예제 #2
0
 public static function getConfig($deepKey = null, $defaultValue = null)
 {
     if (empty(self::$_config)) {
         return $defaultValue;
     }
     if ($deepKey) {
         return self::$_config->getDeepValue($deepKey, $defaultValue);
     }
 }
예제 #3
0
파일: Config.php 프로젝트: solve/config
 public function set($deepKey, $value, $toEnvironment = null)
 {
     //@todo hasDeepKey
     if ($this->_environmentData && ($this->_environmentData->hasDeep($deepKey) && $toEnvironment !== false) || $toEnvironment === true) {
         $this->_environmentData->setDeepValue($deepKey, $value);
     } else {
         $this->_originalData->setDeepValue($deepKey, $value);
     }
     $this->_combinedData->setDeepValue($deepKey, $value);
     return $this;
 }
예제 #4
0
 public function testBasic()
 {
     $storage = new ArrayStorage();
     $storage->offsetSet('key', 'value');
     $this->assertEquals('value', $storage->offsetGet('key'), 'offsetGet after offsetSet');
     $this->assertEquals('value', $storage->get('key'), 'get after offsetSet');
     $this->assertEquals('value', $storage['key'], '[]get after offsetSet');
     $this->assertEquals('value', $storage->key, '__get after offsetSet');
     $storage->key2 = 'value2';
     $this->assertEquals('value2', $storage->key2, '__get after __set');
     $this->assertEquals('value2', $storage->get('key2'), 'get after __set');
     $this->assertEquals('value', $storage->getFirst(), 'first item getter');
     $this->assertEquals('value2', $storage->getLast(), 'last item getter');
 }
예제 #5
0
파일: Environment.php 프로젝트: solve/solve
 public function __call($method, $params)
 {
     $operation = substr($method, 0, 3);
     if (in_array($operation, array('get', 'set'))) {
         if (substr($method, -4) == 'Root') {
             $key = 'roots/' . strtolower(substr($method, 3, -4));
         } else {
             $key = strtolower(substr($method, 3));
         }
         if ($operation == 'get') {
             return $this->_vars->getDeepValue($key);
         } else {
             $this->_vars->setDeepValue($key, $params[0]);
             DC::getEventDispatcher()->dispatchEvent('environment.update', $key);
             return $this;
         }
     } else {
         return $this;
     }
 }
예제 #6
0
파일: Router.php 프로젝트: solve/router
 public function removeRoute($name)
 {
     $this->_routes->offsetUnset($name);
     return $this;
 }
예제 #7
0
 public function get($key = null)
 {
     return $this->_data->get($key);
 }
예제 #8
0
 public function getAll()
 {
     return $this->_storage->getArray();
 }
예제 #9
0
파일: Request.php 프로젝트: solve/http
 public function setVar($name, $value)
 {
     $this->_vars->setDeepValue($name, $value);
     return $this;
 }
예제 #10
0
파일: View.php 프로젝트: solve/solve
 public function getCombinedVars($format = null)
 {
     if (!$format) {
         $format = $this->_responseFormat;
     }
     $combinedVars = new ArrayStorage($this->_vars);
     if ($this->_formatVars->has($format)) {
         $combinedVars->extendDeepValue($this->_formatVars->get($format));
     }
     if ($format == View::FORMAT_HTML) {
         $combinedVars['_baseUri'] = DC::getRouter()->getBaseUri();
     }
     return $combinedVars;
 }