Ejemplo n.º 1
0
 /**
  * Initialize Assets
  *
  * @param  $params
  * @throws FileNotFoundException
  */
 public function init($params)
 {
     // build config parameters
     $config = new Configuration();
     $config->buildConfig($params);
     // check driver
     $this->assetsUri = Safan::handler()->baseUrl . '/' . $config->getPath();
     $this->compressor = new Compressor($config);
     $this->cssManager = new CssManager(DS . $config->getPath() . DS . 'css');
     $this->jsManager = new JsManager(DS . $config->getPath() . DS . 'js');
     $this->config = $config;
     // set to object manager
     $om = Safan::handler()->getObjectManager();
     $om->setObject('assets', $this);
 }
Ejemplo n.º 2
0
 /**
  * @param  Configuration $config
  * @throws \Assets\Exceptions\DirectoryException
  */
 public function __construct(Configuration $config)
 {
     // set paths
     $this->assetsPath = APP_BASE_PATH . DS . 'resource' . DS . $config->getPath();
     if (!is_writable($this->assetsPath)) {
         throw new DirectoryException('Assets path is not writable');
     }
 }