本文整理汇总了PHP中ArrayObject::offsetExists方法的典型用法代码示例。如果您正苦于以下问题:PHP ArrayObject::offsetExists方法的具体用法?PHP ArrayObject::offsetExists怎么用?PHP ArrayObject::offsetExists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArrayObject
的用法示例。
在下文中一共展示了ArrayObject::offsetExists方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getOption
/**
* 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;
}
示例2: has
/**
* 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);
}
示例3: getArgument
/**
* @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;
}
示例4: load
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;
}
示例5: getParam
public function getParam($name)
{
if (!$this->storage->offsetExists($name)) {
return null;
}
return $this->storage->offsetGet($name);
}
示例6: getDirectory
/**
* 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;
}
示例7: getParam
/**
* 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;
}
示例8: getComponentData
/**
* 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);
}
示例9: testArrayObject
function testArrayObject()
{
$obj = new ArrayObject();
$obj[2] = "something";
$this->assertTrue($obj->offsetExists(2));
$this->assertFalse($obj->offsetExists('2'));
$this->assertFalse($obj->offsetExists(1));
}
示例10: getFieldDescriptor
/**
* 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);
}
示例11: _beforeRepositoryFetch
/**
* 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;
}
}
}
示例12: get
/**
* @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;
}
示例13: getMapTo
/**
* 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;
}
}
示例14: registerService
/**
* 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);
}
示例15: get
/**
* 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;
}