init() public method

init the class
Since: 3.0.0
public init ( array $collectionArray = [] ) : Loader
$collectionArray array
return Loader
コード例 #1
0
ファイル: LoaderTest.php プロジェクト: redaxmedia/redaxscript
 /**
  * testRewrite
  *
  * @since 3.0.0
  *
  * @param array $collectionArray
  * @param array $rewriteArray
  * @param string $expect
  *
  * @dataProvider providerRewrite
  */
 public function testRewrite($collectionArray = [], $rewriteArray = [], $expect = null)
 {
     /* setup */
     $optionArray = ['directory' => Stream::url('root/cache/styles'), 'extension' => 'css', 'attribute' => 'href', 'lifetime' => 86400];
     $loader = new Assetic\Loader(Registry::getInstance());
     $loader->init($collectionArray, 'css')->concat($optionArray, $rewriteArray)->concat($optionArray, $rewriteArray);
     /* actual */
     $file = $loader->getCollectionArray()['bundle']['href'];
     $actual = file_get_contents($file);
     /* compare */
     $this->assertEquals($expect, $actual);
 }
コード例 #2
0
ファイル: Script.php プロジェクト: redaxmedia/redaxscript
 /**
  * concat the script
  *
  * @since 3.0.0
  *
  * @param array $optionArray
  *
  * @return Script
  */
 public function concat($optionArray = [])
 {
     $optionArray = array_merge(self::$_optionArray, $optionArray);
     $loader = new Assetic\Loader(Registry::getInstance());
     $loader->init(self::$_collectionArray[self::$_namespace])->concat($optionArray);
     /* update collection */
     self::$_collectionArray[self::$_namespace] = $loader->getCollectionArray();
     return $this;
 }