Devise\Pages\Interpreter\DeviseTag::extractKeyAndCollection PHP Method

extractKeyAndCollection() protected method

Extracts out the key and collection from a string
protected extractKeyAndCollection ( string $str ) : array
$str string
return array
    protected function extractKeyAndCollection($str)
    {
        if (strpos($str, '[') === false) {
            return array(null, $str);
        }
        // this is a devise tag for a collection
        $collection = null;
        $key = null;
        $parts = explode('[', $str);
        if (count($parts) > 1) {
            $collection = array_shift($parts);
            $nextPart = count($parts) > 0 ? explode(']', $parts[0]) : array();
            $key = count($nextPart) > 0 ? array_shift($nextPart) : null;
        }
        return array($collection, $key);
    }