Location: PHPKode > scripts > Redstart Templating > Redstart-Templating-master/Redstart/Templating/Core/System/OptionExtender.php
<?php

namespace Redstart\Templating\Core\System;

/**
 * Option Extender Plugin
 *
 * @package Redstart    
 * @subpackage Redstart_Templating_Core_System
 *
 * @author Hyyan Abo Fakher
 * @since Redstart 1.0
 * @version 1.0
 */
class OptionExtender {

    private $defaults = array();
    private $options = array();

    /**
     * Constrcut New option Extender Plugin
     * @param array $defults
     * @param array $options
     */
    public function __construct(array $defults = array(), array $options = array()) {
        $this->setDefaults($defults);
        $this->extend($options);
    }

    /**
     * Extend default options 
     * 
     * @param array $options
     * @return \Redstart\Templating\Core\System\OptionExtender
     */
    public function extend(array $options) {
        $this->options = array_replace_recursive(
                $this->getDefaults(), array_change_key_case($options)
        );
        return $this;
    }

    /**
     * Get extended options
     * @return array
     */
    public function getOption() {
        return $this->options;
    }

    /**
     * Set Defaults Options
     * @param array $defaults
     * @return \Redstart\Templating\Core\System\OptionExtender
     */
    public function setDefaults(array $defaults) {
        $this->defaults = $defaults;
        return $this;
    }

    /**
     * Get defaults optins
     * @return array
     */
    public function getDefaults() {
        return $this->defaults;
    }

    /**
     * Reset options
     * @return \Redstart\Templating\Core\System\OptionExtender
     */
    public function reset() {
        $this->options = $this->getDefaults();
        return $this;
    }

}

Return current item: Redstart Templating