Calls a selector or throws an exception if it doesn't know what it is.

@param   string  $key    Key passed to the collection
@throws  Exception\Index
@return  mixed   Generally a new Collection instance, but theoretically anything.
19172
protected function callSelector($key)
    {
        foreach ($this->selectors as $selector => $callback) {
            $regex = '/' . $selector . '/i';
            if (preg_match($regex, $key, $matches)) {
                return call_user_func_array($callback, array($this, $key, $matches));
            }
        }

        throw new Exception\Index('Unknown index: ' . $key);
    }
921511
public function raw($key) {
        if (!is_string($key)) {
            throw new \Calf\Exception\InvalidArgument('Key must be string.');
        }

        if (!isset($this->_keys[$key])) {
            throw new \Calf\Exception\Runtime('Key doesn\'t exists: ' . $key);
        }

        return $this->_values[$key];
    }
204111
public function getItem($key)
    {
        if (($find = $this->searchItem($key)) !== null) {
            return $find;
        }

        throw new \Exception(htmlspecialchars("The item $key was not found."));
    }
1317806
public static function get($key)
		{
			self::_cleanPrevious();

			if(!isset($_SESSION[self::$_sessionKey.$key]) && self::$_defaultReturn=="ST__EXCEPTION")
			{
				throw new \Exception("Message with key: ".$key." doesn't exist",404);
			}

			$message = isset($_SESSION[self::$_sessionKey.$key]) ? $_SESSION[self::$_sessionKey.$key] : null;
			if(isset($message[2]['readOnce']) && $message[2]['readOnce'])
			{
				self::remove($key);
			}

			return $message ? $message[1] : self::$_defaultReturn;
		}
427039
public function remove($key) {
		$key = $this->extractKey($key);
		if (isset($this->collection[$key])) {
			$element = $this->collection[$key];
			unset($this->collection[$key]);
			
			return $element;
		}
	}
642462
public function get($index)
    {
        if (null === $index) {
            throw new Exception\InvalidArgumentException('The specified key name is null');
        }

        if (!$this->has($index)) {
            throw new Exception\OutOfBoundsException(sprintf('Index "%s" is out of bounds', $index));
        }

        return $this->collections[$index];
    }
321047
public function remove($key): CollectionInterface
    {
        foreach ($this->indexes as $index) {
            $index->remove($key);
        }

        return parent::remove($key);
    }
1058355
public function clear($key = null)
    {
        if (func_num_args() === 0) {
            $this->attributes = array();
        } elseif ($key === '$id') {
            throw new Exception('[Norm/Model] Restricting clear for $id.');
        } else {
            unset($this->attributes[$key]);
        }

        return $this;
    }
1157099
public function pluck(string $key): ArrayCollection
    {
        return $this->map(function ($value) use ($key) {
            return $value[$key] ?? null;
        });
    }
82342
public function getOption($key) {
        if (array_key_exists($key, $this->_options)) {
            return $this->_options[$key];
        }
        throw new Garp_Browsebox_Exception('Undefined key given: '.$key);
    }
66159
public function getItem(string $key)
    {
        $this->checkCallback();
        if (isset($this->members[$key])) {
            return $this->members[$key];
        } else {
            throw new CollectionException('Unable to retrieve item from collection - key ' . $key . ' not found.');
        }
    }
180833
public function has( $key )
	{
		if( empty( $key ) )																		//  no Key given
			throw new InvalidArgumentException( 'Key must not be empty.' );						//  throw Exception
		if( isset( $this->pairs[$key] ) )														//  Key is set on its own
			return TRUE;
		else																					//  Key has not been found
		{
			$key		.= $this->divider;														//  prepare Prefix Key to seach for
			foreach( $this->pairs as $pairKey => $pairValue )									//  iterate all stores Pairs
			{
				if( $pairKey[0] !== $key[0] )													//  precheck for Performance
					continue;																	//  skip Pair
				if( strpos( $pairKey, $key ) === 0 )											//  Prefix Key is found
					return TRUE;
			}
		}
		return FALSE;
	}
1145597
protected function find(array $array, string $key)
    {
        $item = $array;

        foreach (explode('.', $key) as $segment) {
            if (is_array($item) && array_key_exists($segment, $item)) {
                $item = $item[$segment];
            } else {
                throw new \Exception();
            }
        }

        $this->cache[$key] = &$item;

        return $item;
    }
1110655
public static function pull(string $key)
  {
    if (Self::has($key)) {
      $value = Self::get($key);
      Self::forget($key);

      return $value;
    }

    return null;
  }
1230432
public function get($key)
	{
		if (isset($this->items[$key])) {
			return $this->items[$key];
		} else {
			throw new InvalidKeyException("Collection key '" . $key . "' does not exist.");
		}
	}
750948
public function &offsetGet($key) {
        for($i = 0; $i < count($this->arrays); ++$i) {
            if(Util::exists($this->arrays[$i], $key)) {
                return $this->arrays[$i][$key];
            }
        }
        throw new KeyNotFoundException($key);
    }
117844
protected function getOption($key)
    {
        if (!isset($this->options[$key])) {
            throw new Exception\RuntimeException(sprintf(
                'Option "%s" not found',
                $key
            ));
        }

        return $this->options[$key];
    }