Example #1
0
 /**
  * Returns required option value
  *
  * @param string $optionName
  * @return mixed
  */
 public function getOption($optionName)
 {
     if ($this->_options instanceof ArrayObject && $this->_options->offsetExists($optionName)) {
         return $this->_options->offsetGet($optionName);
     }
     return NULL;
 }
Example #2
0
 /**
  * Test if has datas with $uid key
  * @param mixed $uid
  * @return boolean
  */
 public function has($uid)
 {
     if (null === $this->session) {
         return false;
     }
     return $this->session->offsetExists($uid);
 }
Example #3
0
File: Event.php Project: visor/nano
 /**
  * @return mixed
  * @param string $name
  * @param mixed $defaultValue
  */
 public function getArgument($name, $defaultValue = null)
 {
     if ($this->arguments->offsetExists($name)) {
         return $this->arguments->offsetGet($name);
     }
     return $defaultValue;
 }
Example #4
0
 public function load($name, $throw_exception = true)
 {
     if ($throw_exception && !$this->arrayObject->offsetExists($name)) {
         throw new PluginManagerException(sprintf("Plugin %s not found failure", $name));
     }
     return $this;
 }
 public function getParam($name)
 {
     if (!$this->storage->offsetExists($name)) {
         return null;
     }
     return $this->storage->offsetGet($name);
 }
Example #6
0
 /**
  * Obtem o caminho de um diretorio
  * @param string $index
  * @return boolean
  */
 public function getDirectory($index)
 {
     if ($this->paths->offsetExists($index)) {
         return $this->paths->offsetGet($index);
     }
     return false;
 }
Example #7
0
 /**
  * Obtem um param enviado via Request Http
  * @param int|string $index
  * @return mixed|boolean
  */
 public function getParam($index)
 {
     if ($this->params->offsetExists($index)) {
         return $this->params->offsetGet($index);
     }
     return false;
 }
 /**
  * Get component data
  *
  * @param string $name
  * @return array
  * @throws LocalizedException
  */
 public function getComponentData($name)
 {
     if (!$this->componentData->offsetExists($name)) {
         throw new LocalizedException(new Phrase('The requested component ("' . $name . '") is not found. ' . 'Before using, you must add the implementation.'));
     }
     return (array) $this->componentData->offsetGet($name);
 }
Example #9
0
 function testArrayObject()
 {
     $obj = new ArrayObject();
     $obj[2] = "something";
     $this->assertTrue($obj->offsetExists(2));
     $this->assertFalse($obj->offsetExists('2'));
     $this->assertFalse($obj->offsetExists(1));
 }
 /**
  * returns field descriptor
  *
  * @throws \VisioCrudModeler\Exception\FieldNotFound
  * @return DbFieldDescriptor
  */
 public function getFieldDescriptor($fieldName)
 {
     if (!array_key_exists($fieldName, $this->definition['fields'])) {
         throw new FieldNotFound("field '" . $fieldName . "' not found in '" . $this->getName() . "'");
     }
     if (!$this->fieldDescriptors->offsetExists($fieldName)) {
         $this->fieldDescriptors->offsetSet($fieldName, new WebFieldDescriptor($this, $this->definition['fields'][$fieldName]));
     }
     return $this->fieldDescriptors->offsetGet($fieldName);
 }
Example #11
0
 /**
  * Check the object cache see if the data has already been retrieved
  * 
  * This cache is only persisted throughout a request 
  *
  * @param KCommandContext $context
  *
  * @return void
  */
 protected function _beforeRepositoryFetch(KCommandContext $context)
 {
     if ($this->_enable) {
         $key = $this->_getCacheKey($context->query);
         if (self::$_cache->offsetExists($key)) {
             $context->data = self::$_cache->offsetGet($key);
             return false;
         }
     }
 }
 /**
  * @param string $index
  * @param null|string $defaultValue
  * @param bool   $filtered If you trust foreign input introduced to your PHP code - set to FALSE!
  *
  * @return string
  */
 public function get($index, $defaultValue = null, $filtered = true)
 {
     if ($this->data->offsetExists($index)) {
         if ($filtered === true) {
             // pretty high-level filtering here...
             return self::filter($this->data->offsetGet($index));
         }
         return $this->data->offsetGet($index);
     }
     return $defaultValue;
 }
Example #13
0
 /**
  * Get Map to business or dao
  * @param string $index
  * @param array $map
  */
 public function getMapTo($index, $to)
 {
     if ($this->maps->offsetExists($index)) {
         $map = $this->maps->offsetGet($index);
         if (in_array($to, array('db', 'object'))) {
             return $map[$to];
         }
         return FALSE;
     } else {
         return FALSE;
     }
 }
Example #14
0
 /**
  * Process the registration of one service.
  *
  * @param string $className The class name of the service
  *
  * @throws \Subbly\Api\Exception If class name does not exists
  * @throws \Subbly\Api\Exception If the class does not implement \Subbly\Api\Service\Service
  * @throws \Subbly\Api\Exception If service name is already register
  */
 public function registerService($className)
 {
     if (!class_exists($className)) {
         throw new Exception(sprintf(Exception::SERVICE_CLASS_NOT_EXISTS, $className));
     }
     $service = new $className($this);
     if (!$service instanceof Service) {
         throw new Exception(sprintf(Exception::NOT_A_SERVICE, $className));
     }
     if ($this->services->offsetExists($service->name())) {
         throw new Exception(sprintf(Exception::SERVICE_ALREADY_EXISTS, $service->name()));
     }
     $this->services->offsetSet($service->name(), $service);
 }
Example #15
0
 /**
  * Get an item from an array using "dot" notation.
  *
  * @param string|integer $index The index or identifier.
  * @param mixed          $default
  *
  * @return mixed|null
  */
 public static function get($index, $default = null)
 {
     if (self::$battery->offsetExists($index)) {
         return self::$battery->offsetGet($index);
     }
     $array = self::$battery->getArrayCopy();
     foreach ((array) explode('.', $index) as $segment) {
         if (!is_array($array) || !array_key_exists($segment, $array)) {
             return $default;
         }
         $array = $array[$segment];
     }
     return $array;
 }
 /**
  * Return a synthetic table
  *
  * @param string $table_name table name
  *
  * @throws Exception\InvalidArgumentException if table name is not valid
  *
  * @return Table
  */
 public function table($table_name)
 {
     if (!is_string($table_name)) {
         throw new Exception\InvalidArgumentException(__METHOD__ . ": Table name must be a string");
     }
     if (!$this->localTableCache->offsetExists($table_name)) {
         $tables = $this->metadata()->getTables();
         if (!in_array($table_name, $tables)) {
             throw new Exception\TableNotFoundException(__METHOD__ . ": Table {$table_name} is not found in database, if table exists please make sure cache is updated.");
         }
         $table = new Table($table_name, $this);
         $this->localTableCache->offsetSet($table_name, $table);
     }
     return $this->localTableCache->offsetGet($table_name);
 }
Example #17
0
 public function offsetExists($offset)
 {
     if (!isset($this->data)) {
         $this->lazyInitialization();
     }
     return $this->data->offsetExists($offset);
 }
Example #18
0
 public function offsetUnset($task)
 {
     $this->db->prepare($this->delete)->execute($task);
     if (parent::offsetExists($task)) {
         parent::offsetUnset($task);
     }
 }
 /**
  * Method to retrieve an element from the collection.
  * @access public
  * @throws Exception
  * @return tx_crawler_domain_process
  */
 public function offsetGet($index)
 {
     if (!parent::offsetExists($index)) {
         throw new Exception('Index "' . var_export($index, true) . '" for tx_crawler_domain_process are not available');
     }
     return parent::offsetGet($index);
 }
Example #20
0
 /**
  * Returns the value from the header.
  * If the value is empty, then this method returns an empty string
  *
  * @param String $aValue            
  * @return String
  */
 public final function getValue($aKey)
 {
     if ($this->values->offsetExists($aKey)) {
         return $this->values->offsetGet($aKey);
     }
     return "";
 }
Example #21
0
 public function offsetExists($Index)
 {
     if ($Index === null) {
         return false;
     }
     return parent::offsetExists($Index);
 }
Example #22
0
 /**
  * @param string $event
  * @param \Closure $handler
  * @param int $priority
  */
 protected function addEventCallback($event, \Closure $handler, $priority)
 {
     if (!$this->callbacks->offsetExists($event)) {
         $this->callbacks->offsetSet($event, new \Nano\Event\Queue());
     }
     $this->callbacks->offsetGet($event)->insert($handler, $priority);
 }
Example #23
0
 /**
  * Get a variable.
  *
  * @param   string   $name    Variable name.
  * @return  callable
  * @throws  \Hoa\Math\Exception\UnknownVariable
  */
 public function getVariable($name)
 {
     if (false === $this->_variables->offsetExists($name)) {
         throw new Math\Exception\UnknownVariable('Variable %s does not exist.', 4, $name);
     }
     return $this->_variables[$name]($this);
 }
Example #24
0
 public function offsetExists($offset)
 {
     if (is_null($this->modified)) {
         $this->lazyInitialization();
     }
     return is_object($this->data) && $this->data->offsetExists($offset);
 }
Example #25
0
 /**
  * Loads the plugin instance of the given plugin name.
  *
  * @throws  Enlight_Exception
  * @param   $name
  * @return  Enlight_Plugin_PluginCollection
  */
 public function load($name)
 {
     if (!$this->plugins->offsetExists($name)) {
         throw new Enlight_Exception('Plugin "' . $name . '" not found failure');
     }
     return $this;
 }
 /**
  * @param ReflectionMethod $constructorReflection
  * @param string           $parentParams
  * @param string           $class
  *
  * @return array
  */
 private function getUnifiedParams(\ReflectionMethod $constructorReflection, $parentParams, $class)
 {
     $unifiedParams = [];
     // reflect on what params to pass, in which order
     $params = $constructorReflection->getParameters();
     foreach ($params as $param) {
         /* @var $param \ReflectionParameter */
         $name = $param->name;
         $explicit = $this->params->offsetExists($class) && isset($this->params[$class][$name]);
         if ($explicit) {
             // use the explicit value for this class
             $unifiedParams[$name] = $this->params[$class][$name];
             continue;
         } elseif (isset($parentParams[$name])) {
             // use the implicit value for the parent class
             $unifiedParams[$name] = $parentParams[$name];
             continue;
         } elseif ($param->isDefaultValueAvailable()) {
             // use the external value from the constructor
             $unifiedParams[$name] = $param->getDefaultValue();
             continue;
         }
         // no value, use a null placeholder
         $unifiedParams[$name] = null;
     }
     return $unifiedParams;
 }
Example #27
0
 /**
  * @param $key
  * @param bool $default
  * @return bool
  */
 public function get($key, $default = false)
 {
     if (parent::offsetExists($key)) {
         return parent::offsetGet($key);
     }
     return $default;
 }
Example #28
0
 /**
  * Obtem uma Rota a partir do indice
  * @param string $index
  * @return string|boolean
  */
 public function get($index)
 {
     if ($this->resources instanceof \S9\Model\DAO) {
         $oAdapter = $this->resources->getAdapter();
         return $oAdapter->fetchRow($oAdapter->quoteInto("SELECT a.name AS 'ALIAS',\n                        r.module AS 'MODULE',\n                        r.controller AS 'CONTROLLER',\n                        r.action AS 'ACTION',\n                        r.params AS 'PARAMS',\n                        r.permission AS 'PERMISSION' \n                    FROM alias a, route r \n                    WHERE a.id = r.id_alias AND a.name = ?", strtolower($index)));
     } else {
         if ($this->resources instanceof \ArrayObject) {
             if ($this->resources->offsetExists($index)) {
                 return $this->resources->offsetGet($index);
             }
             return false;
         } else {
             return false;
         }
     }
 }
 /**
  * Gibt das Element der Liste zurück wenn es existiert
  * @param mixed $index
  * @throws InvalidArgumentException
  */
 public function offsetGet($index)
 {
     if (!parent::offsetExists($index)) {
         throw new Dragon_Application_Exception_System('missing record', array('index' => $index));
     }
     return parent::offsetGet($index);
 }
Example #30
0
 /**
  * Get a constant.
  *
  * @param   string  $name    Constant name.
  * @return  mixed
  * @throws  \Hoa\Math\Exception\UnknownFunction
  */
 public function getConstant($name)
 {
     if (false === $this->_constants->offsetExists($name)) {
         throw new Math\Exception\UnknownConstant('Constant %s does not exist', 1, $name);
     }
     return $this->_constants[$name];
 }