protected function _buildNewPreset($preset_name)
    {
        $preset = isset($this->presets_data[$preset_name]) ? $this->presets_data[$preset_name]['data'] : null;
        if (!empty($preset)) {
            $package = $this->getPackage($this->presets_data[$preset_name]['package']);
            $cls_name = Config::get('assets-preset-class');
            if (@class_exists($cls_name)) {
                $interfaces = class_implements($cls_name);
                $config_interface = Config::getInternal('assets-preset-interface');
                if (in_array($config_interface, $interfaces)) {
                    $preset_object = new $cls_name(
                        $preset_name, $preset, $package
                    );
                    return $preset_object;
                } else {
                    throw new \DomainException(
                        sprintf('Preset class "%s" must implement interface "%s"!',
                            $cls_name, $config_interface)
                    );
                }
            } else {
                throw new \DomainException(
                    sprintf('Preset class "%s" not found!', $cls_name)
                );
            }
        } else {
            throw new \InvalidArgumentException(
                sprintf('Unknown preset "%s"!', $preset_name)
            );
        }
        return null;
    }
protected function _buildNewPreset($preset_name)
    {
        $preset = isset($this->presets_data[$preset_name]) ? $this->presets_data[$preset_name]['data'] : null;
        if (!empty($preset)) {
            $package = $this->getPackage($this->presets_data[$preset_name]['package']);
            $cls_name = Config::get('assets-preset-class');
            if (@class_exists($cls_name)) {
                $interfaces = class_implements($cls_name);
                $config_interface = Config::getInternal('assets-preset-interface');
                if (in_array($config_interface, $interfaces)) {
                    $preset_object = new $cls_name(
                        $preset_name, $preset, $package
                    );
                    return $preset_object;
                } else {
                    throw new \DomainException(
                        sprintf('Preset class "%s" must implement interface "%s"!',
                            $cls_name, $config_interface)
                    );
                }
            } else {
                throw new \DomainException(
                    sprintf('Preset class "%s" not found!', $cls_name)
                );
            }
        } else {
            throw new \InvalidArgumentException(
                sprintf('Unknown preset "%s"!', $preset_name)
            );
        }
        return null;
    }
protected function _buildNewPreset ( $ preset_name ) { $ preset = isset ( $ this -> presets_data [ $ preset_name ] ) ? $ this -> presets_data [ $ preset_name ] [ 'data' ] : null ; if ( ! empty ( $ preset ) ) { $ package = $ this -> getPackage ( $ this -> presets_data [ $ preset_name ] [ 'package' ] ) ; $ cls_name = Config :: get ( 'assets-preset-class' ) ; if ( @ class_exists ( $ cls_name ) ) { $ interfaces = class_implements ( $ cls_name ) ; $ config_interface = Config :: getInternal ( 'assets-preset-interface' ) ; if ( in_array ( $ config_interface , $ interfaces ) ) { $ preset_object = new $ cls_name ( $ preset_name , $ preset , $ package ) ; return $ preset_object ; } else { throw new \ DomainException ( sprintf ( 'Preset class "%s" must implement interface "%s"!' , $ cls_name , $ config_interface ) ) ; } } else { throw new \ DomainException ( sprintf ( 'Preset class "%s" not found!' , $ cls_name ) ) ; } } else { throw new \ InvalidArgumentException ( sprintf ( 'Unknown preset "%s"!' , $ preset_name ) ) ; } return null ; }
Build a new preset instance

@param   string $preset_name
@return  \AssetsManager\Package\Preset
@throws  \DomainException if the preset class can't be found or doesn't implement required interface
@throws  \InvalidArgumentException if the preset can't be found
Build a new preset instance