Get filter by name.

@param   string  $name
@param   array   $attributes
@return  Samurai\Samurai\Filter\Filter
542139
public function getFilterByName($name, $attributes = [])
    {
        $filter = null;
        $name = str_replace('\\', DS, ucfirst($name)) . 'Filter.php';
        $file = $this->loader->findFirst($this->application->config('directory.filter') . DS . $name);
        if ($file) {
            $class = $file->getClassName();
            $filter = new $class();
        }

        // not found.
        if (! $filter) {
            throw new Exception\NotFoundException('No such filter. -> ' . $name);
        }
        
        $filter->setAttributes($attributes);
        $filter->setContainer($this->container);
        $this->container->injectDependency($filter);
        return $filter;
    }
160224
public function getChild(
        SimpleXMLElement $element,
        $name,
        array $attributes = []
    ) {
        $xpath = $name . $this->getAttributesXpath($attributes);

        $result = $element->xpath($xpath);
        if (empty($result)) {
            $node = $element->addChild($name);
            $this->setAttributes($node, $attributes);
        } else {
            $node = reset($result);
        }

        return $node;
    }
251634
public static function factory(string $name, array $attributes = []): Custom
    {
        $instance = new static();
        $instance->name = $name;
        $instance->customAttributes = $attributes;

        return $instance;
    }
243468
public function getAttribute($name = null)
    {
        return is_null($name) ? $this->attributes : Arr::get($this->attributes, $name);
    }
374029
public function &getAttributeByName($name)
    {
        if (!isset( $this->attributes[$name] )) {
            throw new \RuntimeException( 'An attribute by the name of \'' . $name . '\' could not be located on the \'' . $this->getName() . '\' entity.' );
        }

        return $this->attributes[$name];
    }
1196191
public function getAttribute(string $name)
    {
        $method = 'get'.\ucfirst($name).'Attribute';
        $value = $this->menu[$name] ?? null;

        if (\method_exists($this, $method)) {
            return $this->container->call([$this, $method], ['value' => $value]);
        }

        return $value;
    }
436586
public function label($name, $attributes = [])
    {
        $attributeString = '';

        if (!isset($attributes['for'])) {
            $attributeString = 'for="'.$name.'"';
        }

        foreach ($attributes as $key => $value) {
            $attributeString .= $key.'="'.$value.'" ';
        }

        return '<label '.$attributeString.'>'.$name.'</label>';
    }
511041
public function get_attribute( $name ) {
		if ( $method = $this->has_map_method( $name ) ) {
			return $this->attributes[ self::OBJECT_KEY ]->{$this->{$method}()};
		}

		if ( $method = $this->has_compute_method( $name ) ) {
			return $this->{$method}();
		}

		if ( isset( $this->attributes[ self::TABLE_KEY ][ $name ] ) ) {
			return $this->attributes[ self::TABLE_KEY ][ $name ];
		}

		if ( isset( $this->defaults[ $name ] ) ) {
			return $this->defaults[ $name ];
		}

		return null;
	}
1046730
public function getFilter($name)
    {
        $filter = $this->getCompiler()->getFilter($name);
        if (is_string($filter) && !function_exists($filter) && class_exists($filter)) {
            $filter = new $filter();
        }

        return $filter;
    }
996155
public function getFilterParameters($name)
    {
        return isset($this->attributes['filters'][$name])
            ? $this->attributes['filters'][$name]['parameters']
            : null;
    }
438380
public function enqueue($name = null, $attributes = array()) {
        return $this->nest(new Voice\Enqueue($name, $attributes));
    }
348004
public function findAttribute($name)
    {
        foreach ($this->attributes as $attribute) {
            if ($attribute->getName() === $name) {
                return $attribute;
            }
        }

        return null;
    }
932348
public function findOne($attributes, $uri)
    {
        $where      = [
            'resource' => $uri,
            'name'     => snake_case(array_get($attributes, 'name'))
        ];
        $components = $this->components->filter(function($item) use($where) {
            return $item->resource == array_get($where, 'resource') && $item->name == array_get($where, 'name');
        });
        $component = $components->count() ? $components->first() : null;
        if (!is_null($component)) {
            return array_merge($component->data, ['id' => $component->id]);
        }
        return [];
    }
426500
public static function attributes_for($name) 
    {
        self::load();
        $data = self::get($name);
        if (!$data) {
            return null;
        }
        return $data;
    }
470106
private function getFilter(array $filters, $name, $default = null)
    {
        if ($this->hasFilter($filters, $name)) {
            return $filters[$name];
        }

        return $default;
    }
891675
protected function getAttribute($name)
    {
        if (isset($this->data[$name])) {
            return $this->data[$name];
        }

        return null;
    }
1237383
public function display($name = null, array $attributes = [])
    {
        return Div::make()->attributes(array_merge(
            static::prepareNameAttribute($name),
            $this->prepareAttributes($attributes)
        ));
    }