Skip to content

Commit

Permalink
Remove support for php<=5.5.
Browse files Browse the repository at this point in the history
  • Loading branch information
Milan Matějček committed May 1, 2017
1 parent 42bd5fb commit 994b889
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 16 deletions.
7 changes: 0 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
language: php
php:
- 5.4
- 5.5
- 5.6
- 7.0
- 7.1

matrix:
allow_failures:
- php: 5.4
- php: 5.5

before_script:
- composer self-update

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Install via composer.
$ composer require h4kuna/assets
```

PHP: 5.3+
Version 0.1.3 support PHP 5.3. Newer support PHP 5.6+.

How to use
==========
Expand Down
6 changes: 3 additions & 3 deletions src/CacheAssets.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function __construct($debugMode, $tempDir)
$this->tempFile = $tempDir . DIRECTORY_SEPARATOR . '_assets';
if (!is_file($this->tempFile)) {
Utils\FileSystem::createDir($tempDir);
$this->files = array();
$this->files = [];
}
}

Expand All @@ -49,7 +49,7 @@ public function load($pathname)
*/
public function clear()
{
$this->files = array();
$this->files = [];
$this->save = TRUE;
}

Expand All @@ -58,7 +58,7 @@ private function loadCache()
if ($this->files !== NULL) {
return;
} elseif ($this->debugMode === TRUE) {
$this->files = array();
$this->files = [];
} else {
$this->files = require $this->tempFile;
}
Expand Down
10 changes: 5 additions & 5 deletions src/DI/AssetsExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,27 @@
class AssetsExtension extends \Nette\DI\CompilerExtension
{

private $defaults = array(
private $defaults = [
'debugMode' => '%debugMode%',
'wwwDir' => '%wwwDir%',
'tempDir' => '%tempDir%/cache',
'cacheBuilder' => NULL
);
];

public function loadConfiguration()
{
$config = $this->getConfig($this->defaults);
$builder = $this->getContainerBuilder();

$cacheAssets = $builder->addDefinition($this->prefix('cache'))
->setClass('h4kuna\\Assets\\CacheAssets', array($config['debugMode'], $config['tempDir']))
->setClass(Assets\CacheAssets::class, [$config['debugMode'], $config['tempDir']])
->setAutowired(FALSE);

$assetFile = $builder->addDefinition($this->prefix('file'))
->setClass('h4kuna\\Assets\\File', array($config['wwwDir'], $cacheAssets));
->setClass(Assets\File::class, [$config['wwwDir'], $cacheAssets]);

$builder->getDefinition('latte.latteFactory')
->addSetup('addFilter', array('asset', new NDI\Statement("array(?, 'createUrl')", array($assetFile))));
->addSetup('addFilter', ['asset', new NDI\Statement("array(?, 'createUrl')", [$assetFile])]);

// build own cache
if ($config['cacheBuilder'] && $config['debugMode'] === FALSE) {
Expand Down

0 comments on commit 994b889

Please sign in to comment.