Skip to content
Browse files

added PEAR packaging, and updated to CS 1.0.2 (closes #1)

  • Loading branch information...
1 parent 37f1e09 commit 1b316952435706743b2bba044164c16f5d0f1ac0 @rodnaph rodnaph committed Jun 24, 2011
View
5 .gitignore
@@ -2,4 +2,7 @@ nbproject
*.svn
log/*
tests/php/bootstrap.php
-
+lib/package.xml
+.DS_Store
+*.tgz
+catalog.xml
View
17 build.xml
@@ -1,10 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
-<project name="boxuk-di" basedir="." default="test">
+<project name="boxuk-di" basedir="." default="test-php">
- <target name="test" description="Run tests">
+ <target name="test-php" description="Run PHP tests">
<mkdir dir="log" />
<exec command="phpunit --testdox --log-junit log/phpunit.xml tests/php/" passthru="true" checkreturn="true" />
</target>
+
+ <target name="test-cs">
+ <exec command="phpcs -n lib/BoxUK --standard=BoxUK"
+ checkReturn="true"
+ passthru="true" />
+ </target>
+
+ <target name="test-php" depends="test-php,test-cs" description="Run all tests"></target>
+
+ <target name="pear-package">
+ <exec command="php package.php" passthru="true" />
+ <exec command="pear package lib/package.xml" passthru="true" />
+ </target>
</project>
View
1 lib/BoxUK/Inject/Annotation/InjectMethod.php
@@ -4,6 +4,7 @@
*
* @Target("method")
*
+ * @package BoxUK\Inject\Annotation
* @copyright Copyright (c) 2010, Box UK
* @license http://opensource.org/licenses/mit-license.php MIT License
* @link http://github.com/boxuk/boxuk-di
View
1 lib/BoxUK/Inject/Annotation/InjectParam.php
@@ -4,6 +4,7 @@
*
* @Target("method")
*
+ * @package BoxUK\Inject\Annotation
* @copyright Copyright (c) 2010, Box UK
* @license http://opensource.org/licenses/mit-license.php MIT License
* @link http://github.com/boxuk/boxuk-di
View
1 lib/BoxUK/Inject/Annotation/InjectProperty.php
@@ -4,6 +4,7 @@
*
* @Target("property")
*
+ * @package BoxUK\Inject\Annotation
* @copyright Copyright (c) 2010, Box UK
* @license http://opensource.org/licenses/mit-license.php MIT License
* @link http://github.com/boxuk/boxuk-di
View
1 lib/BoxUK/Inject/Annotation/ScopeSession.php
@@ -2,6 +2,7 @@
/**
* Indicates a class should have session scope
*
+ * @package BoxUK\Inject\Annotation
* @copyright Copyright (c) 2010, Box UK
* @license http://opensource.org/licenses/mit-license.php MIT License
* @link http://github.com/boxuk/boxuk-di
View
1 lib/BoxUK/Inject/Annotation/ScopeSingleton.php
@@ -4,6 +4,7 @@
*
* @Target("class")
*
+ * @package BoxUK\Inject\Annotation
* @copyright Copyright (c) 2010, Box UK
* @license http://opensource.org/licenses/mit-license.php MIT License
* @link http://github.com/boxuk/boxuk-di
View
2 lib/BoxUK/Inject/Config/Standard.php
@@ -108,7 +108,7 @@ public function getFileCacheFilename() {
/**
* Initialise the config from an array of data
*
- * @param array $data
+ * @param array $data Name/value pairs
*/
public function initFromArray( array $data ) {
View
6 lib/BoxUK/Inject/Helper.php
@@ -24,7 +24,6 @@ class Helper {
/**
* Create a new injection helper for creating classes
*
- * @param array $config
*/
public function __construct( Config $config = null ) {
@@ -88,8 +87,6 @@ public function getReflector() {
/**
* Returns the reflector cache to use based on the parameters
*
- * @param array $aConfig
- *
* @return \BoxUK\Reflect\Cache
*/
public function getReflectorCache() {
@@ -128,7 +125,6 @@ public function getReflectorCache() {
* Sets the key for a cache if it has been configured. The $type defines
* the parameter to pass to the get() method.
*
- * @param Cache $cache
* @param string $type
*/
protected function setKey( Cache $cache, $type ) {
@@ -145,7 +141,7 @@ protected function setKey( Cache $cache, $type ) {
* Gets a config value of uses the default if it's null
*
* @param string $name
- * @param mixed $default
+ * @param mixed $default Default if not found
*
* @return mixed
*/
View
11 lib/BoxUK/Inject/Injector.php
@@ -36,30 +36,29 @@ public function getNewClass( $className );
/**
* Adds a scope to the injector
*
- * @param InjectorScope $scope
*/
public function addScope( Scope $scope );
/**
* Returns a named scope if it has been added to the injector, null otherwise.
*
- * Specify 'singleton' for SingletonScope, etc...
- *
+ * @param string $scopeName eg. 'singleton', or 'session'
+ *
* @return InjectorScope
*/
- public function getScope( $name );
+ public function getScope( $scopeName );
/**
* Checks a class for any scope annotations
*
- * @param object $object
+ * @param object $object Object to check
*/
public function checkScope( $object );
/**
* Do method and property injection on the specified object
*
- * @param object $object
+ * @param object $object Object to inject
*/
public function inject( $object );
View
6 lib/BoxUK/Inject/Scope.php
@@ -25,7 +25,7 @@ public function get( $className );
/**
* Sets a class in this scope, optionally specifying the name.
*
- * @param object $object
+ * @param object $object The object to set in this scope
* @param string $className
*/
public function set( $object, $className=null );
@@ -46,8 +46,8 @@ public function has( $className );
*
* If the reflected class is not passed in then it should be created.
*
- * @param object $object
- * @param ReflectionAnnotatedClass $oAnnotation
+ * @param object $object Object to look for in this scope
+ * @param string $className
*
* @return boolean
*/
View
2 lib/BoxUK/Inject/Scope/SessionHandler.php
@@ -15,6 +15,8 @@
/**
* Indicates if the key exists in the session handler
*
+ * @param string $key
+ *
* @return bool
*/
public function has( $key );
View
8 lib/BoxUK/Inject/Scope/SessionScope.php
@@ -30,8 +30,6 @@ class SessionScope extends StorageScope {
/**
* Create a new session scope handler
*
- * @param Reflector $reflector
- * @param SessionManager $sessionHandler
*/
public function __construct( Reflector $reflector, SessionHandler $sessionHandler ) {
@@ -57,11 +55,11 @@ protected function getData() {
/**
* Sets the specified data in the session
*
- * @param array $aData
+ * @param array $data Key/value data
*/
- protected function setData( array $aData ) {
+ protected function setData( array $data ) {
- $this->sessionHandler->set( self::SESSION_KEY, $aData );
+ $this->sessionHandler->set( self::SESSION_KEY, $data );
}
View
7 lib/BoxUK/Inject/Scope/SingletonScope.php
@@ -28,7 +28,6 @@ class SingletonScope implements Scope {
/**
* Init the scope
*
- * @param AmaxusReflector $reflector
*/
public function init( Reflector $reflector ) {
@@ -67,8 +66,8 @@ public function has( $className ) {
/**
* Checks if the class has been annotated as a singleton
*
- * @param object $object
- * @param ReflectionAnnotatedClass $oReflClass
+ * @param object $object Object to check
+ * @param string $className
*
* @return boolean
*/
@@ -97,7 +96,7 @@ public function check( $object, $className ) {
/**
* Stores the class in this scope
*
- * @param object $object
+ * @param object $object Object to set
* @param string $className
*/
public function set( $object, $className=null ) {
View
6 lib/BoxUK/Inject/Scope/StorageScope.php
@@ -82,7 +82,7 @@ public function get( $className ) {
/**
* Checks a class to see if it is annotated with the storage scope
*
- * @param object $object
+ * @param object $object Object to check
* @param string $className
*
* @return boolean
@@ -114,7 +114,7 @@ public function has( $className ) {
/**
* Stores the object, optionally specifying the name
*
- * @param object $object
+ * @param object $object Object to set
* @param string $className
*/
public function set( $object, $className=null ) {
@@ -156,7 +156,7 @@ public function __destruct() {
/**
* Persists the array of data in storage
*
- * @param array $data
+ * @param array $data Key/value data
*/
abstract protected function setData( array $data );
View
15 lib/BoxUK/Inject/Standard.php
@@ -40,7 +40,6 @@ class Standard implements Injector {
/**
* Create a new injector
*
- * @param BoxUK\Reflect\Reflector $reflector
*/
public function __construct( Reflector $reflector ) {
@@ -68,7 +67,6 @@ public function init() {
/**
* Adds a scope to the injector
*
- * @param BoxUK\Inject\Scope $scope
*/
public function addScope( Scope $scope ) {
@@ -124,7 +122,7 @@ public function getClass( $className ) {
* This will walk up the inheritance chain until it either finds a scope
* annotation or hits the root.
*
- * @param object $object
+ * @param object $object Object to check
*/
public function checkScope( $object ) {
@@ -165,7 +163,7 @@ public function getNewClass( $className ) {
/**
* Do method and property injection on the specified object
*
- * @param object $object
+ * @param object $object Object to inject
*/
public function inject( $object ) {
@@ -278,6 +276,7 @@ protected function getParamClass( $className, $methodName, $paramName, $paramCla
* @param string $className
* @param string $methodName
* @param string $paramName
+ * @param string $paramClass
*
* @return string
*/
@@ -300,7 +299,7 @@ protected function getParamClassFromAnnotation( $className, $methodName, $paramN
* Checks a classes method to find injectable ones (InjectMethod), but won't
* descend into ignored parent classes.
*
- * @param object $object
+ * @param object $object Object to inject
*/
protected function injectMethods( $object ) {
@@ -316,7 +315,7 @@ protected function injectMethods( $object ) {
/**
* Injects a method with it's parameters
*
- * @param object $ $object
+ * @param object $object Object to inject
* @param string $methodName
*/
protected function injectMethod( $object, $methodName ) {
@@ -330,7 +329,7 @@ protected function injectMethod( $object, $methodName ) {
/**
* Do property injection on the specified class
*
- * @param object $object
+ * @param object $object Object to inject
*/
protected function injectProperties( $object ) {
@@ -346,7 +345,7 @@ protected function injectProperties( $object ) {
/**
* Inject the specified property of the class
*
- * @param object $object
+ * @param object $object Object to inject
* @param string $propertyName
*/
protected function injectProperty( $object, $propertyName ) {
View
6 lib/BoxUK/Reflect/Cache.php
@@ -19,7 +19,7 @@
* array if there is no cached data. If there is data in the cache that will
* be returned, use rawRead() to force getting new data.
*
- * @returna rray
+ * @return array
*/
public function read();
@@ -34,7 +34,7 @@ public function rawRead();
* Writes the array of reflection cache information to the cache object, but
* this is not committed to the persistence layer yet.
*
- * @param array $cacheData
+ * @param array $cacheData Cache data
*/
public function write( array $cacheData );
@@ -67,14 +67,12 @@ public function getKey();
/**
* Adds a listener for notification when the key changes
*
- * @param KeyListener $listener
*/
public function addKeyListener( KeyListener $listener );
/**
* Removes a listener that has been added for key changes
*
- * @param KeyListener $listener
*/
public function removeKeyListener( KeyListener $listener );
View
1 lib/BoxUK/Reflect/Cache/Apc.php
@@ -30,7 +30,6 @@ public function init() {
/**
* Set the APC wrapper to use
*
- * @param ApcWrapper $apcWrapper
*/
public function setApcWrapper( ApcWrapper $apcWrapper ) {
View
2 lib/BoxUK/Reflect/Cache/ApcWrapper.php
@@ -29,7 +29,7 @@ public function fetch( $key ) {
* Store the value for the specified key
*
* @param string $key
- * @param mixed $data
+ * @param mixed $data Cache data
*/
public function store( $key, $data ) {
View
4 lib/BoxUK/Reflect/Cache/Base.php
@@ -50,7 +50,7 @@ public function __construct() {
/**
* Writes data into the cache (not committed yet though)
*
- * @param array $cacheData
+ * @param array $cacheData Cache data
*/
public function write( array $cacheData ) {
@@ -148,7 +148,6 @@ protected function getDefaultKey() {
/**
* Adds a key listener for notifications when the cache key is changed
*
- * @param KeyListener $listener
*/
public function addKeyListener( KeyListener $listener ) {
@@ -159,7 +158,6 @@ public function addKeyListener( KeyListener $listener ) {
/**
* Removed a key listener if it has been added
*
- * @param KeyListener $listener
*/
public function removeKeyListener( KeyListener $listener ) {
View
1 lib/BoxUK/Reflect/Cache/Memcache.php
@@ -108,7 +108,6 @@ public function getPort() {
/**
* Sets the internal Memcache object
*
- * @param \Memcache $memcache
*/
public function setMemcache( \Memcache $memcache ) {
View
61 lib/BoxUK/Reflect/Caching.php
@@ -33,7 +33,6 @@ class Caching extends Standard implements KeyListener {
/**
* Creates a new caching reflector using the specified cache type
*
- * @param Cache $cache
*/
public function __construct( Cache $cache ) {
@@ -114,7 +113,7 @@ public function afterKeyChange( $oldKey, $newKey ) {
* Handles a call to a method and caches the results
*
* @param string $method
- * @param array $params
+ * @param array $params Method parameters to be passed to $method
*
* @return mixed
*/
@@ -138,6 +137,8 @@ protected function handle( $method, $params ) {
/**
* Intercept method
+ *
+ * @param string $className
*/
public function getParentClass( $className ) {
@@ -147,24 +148,32 @@ public function getParentClass( $className ) {
/**
* Intercept method
+ *
+ * @param string $className
+ * @param string $methodName
*/
- public function hasMethod( $className, $method ) {
+ public function hasMethod( $className, $methodName ) {
- return $this->handle( 'hasMethod', array($className,$method) );
+ return $this->handle( 'hasMethod', array($className,$methodName) );
}
/**
* Intercept method
+ *
+ * @param string $className
+ * @param string $methodName
*/
- public function getMethodParams( $className, $method ) {
+ public function getMethodParams( $className, $methodName ) {
- return $this->handle( 'getMethodParams', array($className,$method) );
+ return $this->handle( 'getMethodParams', array($className,$methodName) );
}
/**
* Intercept method
+ *
+ * @param string $className
*/
public function getMethods( $className ) {
@@ -174,6 +183,9 @@ public function getMethods( $className ) {
/**
* Intercept method
+ *
+ * @param string $className
+ * @param string $annotation
*/
public function classHasAnnotation( $className, $annotation ) {
@@ -183,6 +195,10 @@ public function classHasAnnotation( $className, $annotation ) {
/**
* Intercept method
+ *
+ * @param string $className
+ * @param string $methodName
+ * @param string $annotation
*/
public function methodHasAnnotation( $className, $methodName, $annotation ) {
@@ -192,6 +208,10 @@ public function methodHasAnnotation( $className, $methodName, $annotation ) {
/**
* Intercept method
+ *
+ * @param string $className
+ * @param string $methodName
+ * @param string $annotation
*/
public function getMethodAnnotations( $className, $methodName, $annotation ) {
@@ -201,6 +221,9 @@ public function getMethodAnnotations( $className, $methodName, $annotation ) {
/**
* Intercept method
+ *
+ * @param string $className
+ * @param string $annotation
*/
public function getClassAnnotation( $className, $annotation ) {
@@ -210,6 +233,10 @@ public function getClassAnnotation( $className, $annotation ) {
/**
* Intercept method
+ *
+ * @param string $className
+ * @param string $methodName
+ * @param string $annotation
*/
public function getMethodAnnotation( $className, $methodName, $annotation ) {
@@ -219,6 +246,8 @@ public function getMethodAnnotation( $className, $methodName, $annotation ) {
/**
* Intercept method
+ *
+ * @param string $className
*/
public function getProperties( $className ) {
@@ -228,6 +257,10 @@ public function getProperties( $className ) {
/**
* Intercept method
+ *
+ * @param string $className
+ * @param string $propertyName
+ * @param string $annotation
*/
public function propertyHasAnnotation( $className, $propertyName, $annotation ) {
@@ -237,6 +270,9 @@ public function propertyHasAnnotation( $className, $propertyName, $annotation )
/**
* Intercept method
+ *
+ * @param string $className
+ * @param string $propertyName
*/
public function getPropertyClass( $className, $propertyName ) {
@@ -246,6 +282,10 @@ public function getPropertyClass( $className, $propertyName ) {
/**
* Intercept method
+ *
+ * @param string $className
+ * @param string $propertyName
+ * @param string $annotation
*/
public function getPropertyAnnotation( $className, $propertyName, $annotation ) {
@@ -254,6 +294,9 @@ public function getPropertyAnnotation( $className, $propertyName, $annotation )
/**
* Intercept method
+ *
+ * @param string $className
+ * @param string $propertyName
*/
public function isPublicProperty( $className, $propertyName ) {
@@ -263,6 +306,9 @@ public function isPublicProperty( $className, $propertyName ) {
/**
* Intercept method
+ *
+ * @param string $className
+ * @param string $annotation
*/
public function getMethodsWithAnnotation( $className, $annotation ) {
@@ -272,6 +318,9 @@ public function getMethodsWithAnnotation( $className, $annotation ) {
/**
* Intercept method
+ *
+ * @param string $className
+ * @param string $annotation
*/
public function getPropertiesWithAnnotation( $className, $annotation ) {
View
8 lib/BoxUK/Reflect/Standard.php
@@ -66,8 +66,8 @@ public function getParentClass( $className ) {
/**
* Indicates if a class has a method
*
- * @param string $class
- * @param string $method
+ * @param string $className
+ * @param string $methodName
*
* @return boolean
*/
@@ -88,8 +88,8 @@ public function hasMethod( $className, $methodName ) {
/**
* Returns info about a methods parameters
*
- * @param string $class
- * @param string $method
+ * @param string $className
+ * @param string $methodName
*
* @return array
*/
View
28 package.php
@@ -0,0 +1,28 @@
+<?php
+
+define( 'VERSION', '1.4.3' );
+
+require_once( 'PEAR/PackageFileManager2.php' );
+
+$packagexml = new PEAR_PackageFileManager2;
+$packagexml->setOptions(array(
+ 'packagedirectory' => 'lib',
+ 'baseinstalldir' => '/'
+));
+
+$packagexml->setPackage( 'inject' );
+$packagexml->setSummary( 'Dependency Injection and Reflection' );
+$packagexml->setDescription( '-' );
+$packagexml->setChannel( 'pear.boxuk.com' );
+$packagexml->setAPIVersion( VERSION );
+$packagexml->setReleaseVersion( VERSION );
+$packagexml->setReleaseStability( 'stable' );
+$packagexml->setAPIStability( 'stable' );
+$packagexml->setNotes( "-" );
+$packagexml->setPackageType( 'php' );
+$packagexml->setPhpDep( '5.3.0' );
+$packagexml->setPearinstallerDep( '1.3.0' );
+$packagexml->addMaintainer( 'lead', 'coders', 'coders', 'coders@boxuk.com' );
+$packagexml->setLicense( 'MIT License', 'http://opensource.org/licenses/mit-license.php' );
+$packagexml->generateContents();
+$packagexml->writePackageFile();

0 comments on commit 1b31695

Please sign in to comment.
Something went wrong with that request. Please try again.