Skip to content
This repository was archived by the owner on Sep 12, 2022. It is now read-only.

Commit

Permalink
Merge pull request #27 from AOEpeople/add-travis-config
Browse files Browse the repository at this point in the history
Add travis config,add PHPCS ruleset, and fix PHPCS errors
  • Loading branch information
LeeSaferite committed Mar 4, 2015
2 parents 38b1af4 + c66077b commit 45838f4
Show file tree
Hide file tree
Showing 9 changed files with 70 additions and 27 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/vendor
/composer.lock
17 changes: 17 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
language: php
php:
- 5.3
- 5.4
- 5.5
- 5.6
- hhvm
matrix:
allow_failures:
- php: hhvm
before_script:
# Composer
- composer --no-interaction self-update
- composer --no-interaction --prefer-source --dev install
script:
# Code style
- php vendor/bin/phpcs --runtime-set ignore_warnings_on_exit true --standard=./phpcs.xml --encoding=utf-8 --report-width=120 ./app ./lib ./shell
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
# AOE ClassPathCache
# AOE ClassPathCache [![Build Status](https://travis-ci.org/AOEpeople/Aoe_ClassPathCache.svg?branch=master)](https://travis-ci.org/AOEpeople/Aoe_ClassPathCache)

## Change log

* v0.5.1
* Added Travis CI config file
* Add PHPCS ruleset and check
* Fixed several PSR-2 related errors in the code
* Added tracking of the Travis CI build status for master into the README

* v0.5.0
* Changed code pool from 'local' to 'community'.
NB: This change could possibly break things if you are manually installing the code instead of using modman/composer
Expand Down
2 changes: 0 additions & 2 deletions app/code/community/Aoe/ClassPathCache/Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,4 @@ public function getUrl()
)
);
}


}
2 changes: 1 addition & 1 deletion app/code/community/Aoe/ClassPathCache/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<config>
<modules>
<Aoe_ClassPathCache>
<version>0.5.0</version>
<version>0.5.1</version>
</Aoe_ClassPathCache>
</modules>
<global>
Expand Down
37 changes: 18 additions & 19 deletions app/code/community/Varien/Autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ class Varien_Autoload
const SCOPE_FILE_PREFIX = '__';
const CACHE_KEY_PREFIX = 'classPathCache';

static protected $_instance;
static protected $_scope = 'default';
static protected $_cache = array();
static protected $_numberOfFilesAddedToCache = 0;
protected static $_instance;
protected static $_scope = 'default';
protected static $_cache = array();
protected static $_numberOfFilesAddedToCache = 0;

static public $useAPC = null;
static protected $cacheKey = self::CACHE_KEY_PREFIX;
public static $useAPC = null;
protected static $cacheKey = self::CACHE_KEY_PREFIX;

/* Base Path */
static protected $_BP = '';
protected static $_BP = '';

/**
* Class constructor
Expand Down Expand Up @@ -50,7 +50,7 @@ public function __construct()
*
* @return Varien_Autoload
*/
static public function instance()
public static function instance()
{
if (!self::$_instance) {
self::$_instance = new Varien_Autoload();
Expand All @@ -61,7 +61,7 @@ static public function instance()
/**
* Register SPL autoload function
*/
static public function register()
public static function register()
{
spl_autoload_register(array(self::instance(), 'autoload'));
}
Expand Down Expand Up @@ -96,7 +96,7 @@ public function autoload($class)
*
* @return string
*/
static function getFileFromClassName($className)
public static function getFileFromClassName($className)
{
$className = ltrim($className, '\\');
$fileName = '';
Expand All @@ -119,7 +119,7 @@ static function getFileFromClassName($className)
*
* @param string $code scope code
*/
static public function registerScope($code)
public static function registerScope($code)
{
self::$_scope = $code;
}
Expand All @@ -129,7 +129,7 @@ static public function registerScope($code)
*
* @return string
*/
static public function getScope()
public static function getScope()
{
return self::$_scope;
}
Expand All @@ -139,7 +139,7 @@ static public function getScope()
*
* @return string
*/
static public function getCacheFilePath()
public static function getCacheFilePath()
{
return self::$_BP . DIRECTORY_SEPARATOR . 'var' . DIRECTORY_SEPARATOR . 'cache' . DIRECTORY_SEPARATOR . 'classPathCache.php';
}
Expand All @@ -149,7 +149,7 @@ static public function getCacheFilePath()
*
* @return string
*/
static public function getRevalidateFlagPath()
public static function getRevalidateFlagPath()
{
return self::$_BP . DIRECTORY_SEPARATOR . 'var' . DIRECTORY_SEPARATOR . 'cache' . DIRECTORY_SEPARATOR . 'classPathCache.flag';
}
Expand All @@ -159,7 +159,7 @@ static public function getRevalidateFlagPath()
*
* @param array $cache
*/
static public function setCache(array $cache)
public static function setCache(array $cache)
{
self::$_cache = $cache;
}
Expand All @@ -169,7 +169,7 @@ static public function setCache(array $cache)
*
* @return array
*/
static public function loadCacheContent()
public static function loadCacheContent()
{

if (self::isApcUsed()) {
Expand Down Expand Up @@ -203,7 +203,7 @@ static public function loadCacheContent()
*
* @return mixed
*/
static public function getFullPath($className)
public static function getFullPath($className)
{
if (!isset(self::$_cache[$className])) {
self::$_cache[$className] = self::searchFullPath(self::getFileFromClassName($className));
Expand All @@ -223,7 +223,7 @@ static public function getFullPath($className)
*
* @return bool|string
*/
static public function searchFullPath($filename)
public static function searchFullPath($filename)
{
// return stream_resolve_include_path($filename);
$paths = explode(PATH_SEPARATOR, get_include_path());
Expand Down Expand Up @@ -289,5 +289,4 @@ public function __destruct()
}
}
}

}
10 changes: 9 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,18 @@
"authors": [
{
"name": "Fabrizio Branca",
"email": "mail@{firstname}-{lastname}.de"
"email": "{firstname}.{lastname}@aoe.com"
}
],
"require": {
"php": ">=5.3",
"magento-hackathon/magento-composer-installer": "*"
},
"require-dev": {
"squizlabs/php_codesniffer": "2.*"
},
"extra": {
"skip-package-deployment": true,
"magento-root-dir": "./"
}
}
16 changes: 16 additions & 0 deletions phpcs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0"?>
<ruleset name="Magento1">
<description>Magento extension ruleset based on PSR-2 but modified for Magento 1</description>
<rule ref="PSR2">
<!-- Magento 1 class names don't comply so ignore these rules -->
<exclude name="PSR1.Classes.ClassDeclaration.MissingNamespace"/>
<exclude name="Squiz.Classes.ValidClassName.NotCamelCaps"/>

<!-- Magento standards use underscore for private methods so lets ignore this -->
<exclude name="PSR2.Methods.MethodDeclaration.Underscore"/>
<exclude name="PSR2.Classes.PropertyDeclaration.Underscore"/>

<!-- Magento requires including files in some cases so we either exlude this test or add DocBlocks -->
<exclude name="PSR1.Files.SideEffects"/>
</rule>
</ruleset>
3 changes: 0 additions & 3 deletions shell/aoe_classpathcache.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,7 @@ public function usageHelp()
}
return $help;
}


}

$shell = new Aoe_ClassPathCache_Shell();
$shell->run();

0 comments on commit 45838f4

Please sign in to comment.