1:  2:  3:  4:  5:  6:  7:  8:  9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 
<?php
namespace Omeka\View\Helper;

use Zend\View\Helper\AbstractHelper;

/**
 * View helper for getting theme settings.
 */
class ThemeSetting extends AbstractHelper
{
    /**
     * @var array
     */
    protected $settings;

    /**
     * Construct the helper.
     *
     * @param array $settings
     */
    public function __construct(array $settings)
    {
        $this->settings = $settings;
    }

    /**
     * Get a setting
     *
     * By default, will return null if no setting exists with the passed ID, but the default
     * can be changed by passing the second argument
     *
     * @param string $id
     * @param mixed $default
     * @return mixed
     */
    public function __invoke($id, $default = null)
    {
        if (isset($this->settings[$id])) {
            return $this->settings[$id];
        }

        return $default;
    }
}