Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
4 / 4
CRAP
100.00% covered (success)
100.00%
14 / 14
HelperRepository
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
4 / 4
6
100.00% covered (success)
100.00%
14 / 14
 __construct
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
10 / 10
 put
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
 has
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 get
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
1 / 1
<?php
/**
 * Part of the Caffeinated PHP packages.
 *
 * MIT License and copyright information bundled with this package in the LICENSE file
 */
namespace Radic\BladeExtensions\Helpers;
use Illuminate\Contracts\Container\Container;
use Illuminate\Support\Traits\Macroable;
/**
 * This is the HelperRepository.
 *
 * @package        Radic\BladeExtensions
 * @author         Caffeinated Dev Team
 * @copyright      Copyright (c) 2015, Caffeinated
 * @license        https://tldrlegal.com/license/mit-license MIT License
 */
class HelperRepository
{
    use Macroable;
    protected $helpers;
    protected $container;
    /**
     * @inheritDoc
     */
    public function __construct(Container $container)
    {
        $this->container = $container;
        $this->helpers   = [ ];
        $helpers = [
            'loop'     => LoopFactory::class,
            'embed'    => EmbedStacker::class,
            'markdown' => Markdown::class,
            'minifier' => Minifier::class
        ];
        foreach ($helpers as $name => $class) {
            $this->put($name, $container->make($class));
        }
    }
    public function put($key, $data)
    {
        $this->helpers[ $key ] = $data;
    }
    public function has($key)
    {
        return isset($this->helpers[ $key ]);
    }
    public function get($key, $default = null)
    {
        return $this->has($key) ? $this->helpers[ $key ] : $default;
    }
}