Changeset 1127

Show
Ignore:
Timestamp:
12/06/07 23:11:20 (7 months ago)
Author:
mikey
Message:

fixed a bunch of coding style issues detected with new coding style check mechanism

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/main/php/net/stubbles/auth/stubAuthResult.php

    r755 r1127  
    1414 * @subpackage  auth 
    1515 */ 
    16 class stubAuthResult extends stubSerializableObject  
     16class stubAuthResult extends stubSerializableObject 
    1717{ 
    1818    /** 
  • trunk/src/main/php/net/stubbles/events/stubCallbackListener.php

    r1035 r1127  
    6767     * @param   string         $method      method of class to callback when listener is notified 
    6868     * @param   bool           $autoRemove  optional  whether listener should be removed if it has handled one event or not 
     69     * @throws  stubIllegalArgumentException 
    6970     */ 
    7071    public function __construct($instance, $method, $autoRemove = false) 
     
    101102        $params = $this->refMethod->getParameters(); 
    102103         
    103         if (count($params) == 0) { 
     104        if (count($params) === 0) { 
    104105            try { 
    105106                $this->refMethod->invoke($this->instance); 
     
    115116        foreach ($params as $param) { 
    116117            // if argument of method takes an event 
    117             if (null != $param->getClass() && 'stubEvent' == $param->getClass()->getName()) { 
     118            if (null != $param->getClass() && 'stubEvent' === $param->getClass()->getName()) { 
    118119                // pass the event as argument 
    119120                $args[] = $event; 
    120121                continue; 
    121             // elseif argument of method takes the type of the context if context is not null 
    122             } elseif (null != $param->getClass() && null != $event->getContext() && get_class($event->getContext()) == $param->getClass()->getName()) { 
     122            } elseif (null != $param->getClass() && null !== $event->getContext() && get_class($event->getContext()) === $param->getClass()->getName()) { 
     123                // argument of method takes the type of the context if context is not null 
    123124                // pass the context as argument 
    124125                $args[] = $event->getContext(); 
    125126                continue; 
    126             // if param is optional in general 
    127             } elseif ($param->isOptional() == true) { 
    128                 // take the default value if available 
    129                 if ($param->isDefaultValueAvailable() == true) { 
     127            } elseif ($param->isOptional() === true) { 
     128                // param is optional in general: take the default value if available 
     129                if ($param->isDefaultValueAvailable() === true) { 
    130130                    $args[] = $param->getDefaultValue(); 
    131131                } else { 
     
    134134                 
    135135                continue; 
    136             // if param allows null 
    137             } elseif ($param->allowsNull() == true) { 
     136            } elseif ($param->allowsNull() === true) { 
    138137                $args[] = null; 
    139138                continue; 
     
    218217    private function createInstance() 
    219218    { 
    220         if (is_object($this->instance) == true) { 
     219        if (is_object($this->instance) === true) { 
    221220            if (null == $this->refMethod) { 
    222221                $refClass = new ReflectionClass($this->class); 
     
    252251    private function loadMethod(ReflectionClass $refClass) 
    253252    { 
    254         if ($refClass->hasMethod($this->method) == false) { 
     253        if ($refClass->hasMethod($this->method) === false) { 
    255254            throw new stubCallbackException('Could not execute ' . $this->class . '::' . $this->method . '(), method does not exist.'); 
    256255        } 
     
    258257        // we can not call non-public methods 
    259258        $this->refMethod = $refClass->getMethod($this->method); 
    260         if ($this->refMethod->isPublic() == false) { 
     259        if ($this->refMethod->isPublic() === false) { 
    261260            throw new stubCallbackException('Could not execute ' . $this->class . '::' . $this->method . '(), method is not declared as public.'); 
    262261        } 
    263262         
    264         if ($this->refMethod->isStatic() == true) { 
     263        if ($this->refMethod->isStatic() === true) { 
    265264            $this->instance = null; 
    266265        } 
  • trunk/src/main/php/net/stubbles/events/stubLazyEventListener.php

    r1035 r1127  
    6969     * 
    7070     * @return  stubEventListener 
     71     * @throws  stubRuntimeException 
    7172     */ 
    7273    protected function createInstance() 
  • trunk/src/main/php/net/stubbles/ioc/annotations/stubInjectAnnotation.php

    r844 r1127  
    11<?php 
    22/** 
    3  * Annotation to mark a method that is used for 
    4  * dependency injection 
     3 * Annotation to mark a method that is used for dependency injection 
    54 * 
    65 * @author      Stephan Schmidt <schst@stubbles.net> 
    76 * @package     stubbles 
    8  * @subpackage  ioc_injection 
     7 * @subpackage  ioc_annotations 
    98 */ 
    109stubClassLoader::load('net.stubbles.reflection.annotations.stubAbstractAnnotation'); 
    11  
    1210/** 
    13  * Annotation to mark a method that is used for 
    14  * dependency injection 
     11 * Annotation to mark a method that is used for dependency injection 
    1512 * 
    1613 * @package     stubbles 
    17  * @subpackage  ioc_injection 
     14 * @subpackage  ioc_annotations 
    1815 */ 
    1916class stubInjectAnnotation extends stubAbstractAnnotation 
     
    5148     * @return boolean 
    5249     */ 
    53     public function isOptional() { 
     50    public function isOptional() 
     51    { 
    5452        return $this->optional; 
    5553    } 
  • trunk/src/main/php/net/stubbles/ioc/annotations/stubNamedAnnotation.php

    r844 r1127  
    55 * @author      Stephan Schmidt <schst@stubbles.net> 
    66 * @package     stubbles 
    7  * @subpackage  ioc_injection 
     7 * @subpackage  ioc_annotations 
    88 */ 
    9  
    109stubClassLoader::load('net.stubbles.reflection.annotations.stubAbstractAnnotation'); 
    11  
    1210/** 
    1311 * Annotation to name an injection 
    1412 * 
    1513 * @package     stubbles 
    16  * @subpackage  ioc_injection 
     14 * @subpackage  ioc_annotations 
    1715 */ 
    1816class stubNamedAnnotation extends stubAbstractAnnotation 
  • trunk/src/main/php/net/stubbles/ioc/annotations/stubSingletonAnnotation.php

    r821 r1127  
    55 * @author      Stephan Schmidt <schst@stubbles.net> 
    66 * @package     stubbles 
    7  * @subpackage  ioc_injection 
     7 * @subpackage  ioc_annotations 
    88 */ 
    99 
     
    1515 * 
    1616 * @package     stubbles 
    17  * @subpackage  ioc_injection 
     17 * @subpackage  ioc_annotations 
    1818 */ 
    1919class stubSingletonAnnotation extends stubAbstractAnnotation 
  • trunk/src/main/php/net/stubbles/ioc/exceptions/stubBindingException.php

    r852 r1127  
    55 * @author      Stephan Schmidt <schst@stubbles.net> 
    66 * @package     stubbles 
    7  * @subpackage  ioc_injection 
     7 * @subpackage  ioc_exceptions 
    88 */ 
    99 
     
    1414 * 
    1515 * @package     stubbles 
    16  * @subpackage  ioc_injection 
     16 * @subpackage  ioc_exceptions 
    1717 */ 
    1818class stubBindingException extends stubInjectionException 
    1919{ 
    20  
     20    // intentionally empty 
    2121} 
    2222?> 
  • trunk/src/main/php/net/stubbles/ioc/exceptions/stubInjectionException.php

    r844 r1127  
    55 * @author      Frank Kleine <mikey@stubbles.net> 
    66 * @package     stubbles 
    7  * @subpackage  ioc_injection 
     7 * @subpackage  ioc_exceptions 
    88 */ 
    99/** 
     
    1111 * 
    1212 * @package     stubbles 
    13  * @subpackage  ioc_injection 
     13 * @subpackage  ioc_exceptions 
    1414 */ 
    1515class stubInjectionException extends stubException 
    1616{ 
    17      
     17    // intentionally empty 
    1818} 
    1919?> 
  • trunk/src/main/php/net/stubbles/ioc/stubBinder.php

    r1009 r1127  
    3030 * @subpackage  ioc 
    3131 */ 
    32 class stubBinder extends stubBaseObject { 
    33  
     32class stubBinder extends stubBaseObject 
     33
    3434    /** 
    3535     * Key for storing the binder in the registry 
     
    4949     * @param stubInjector $injector 
    5050     */ 
    51     public function __construct(stubInjector $injector = null) { 
     51    public function __construct(stubInjector $injector = null) 
     52    { 
    5253        if ($injector === null) { 
    5354            $this->injector = new stubInjector(); 
     
    6364     * @return stubClassBinding 
    6465     */ 
    65     public function bind($interface) { 
     66    public function bind($interface) 
     67    { 
    6668        $binding = new stubClassBinding($this->injector, $interface); 
    6769        $this->injector->addBinding($binding); 
     
    7476     * @return stubConstantBinding 
    7577     */ 
    76     public function bindConstant() { 
     78    public function bindConstant() 
     79    { 
    7780        $binding = new stubConstantBinding($this->injector); 
    7881        $this->injector->addBinding($binding); 
     
    8588     * @return stubInjector 
    8689     */ 
    87     public function getInjector() { 
     90    public function getInjector() 
     91    { 
    8892        return $this->injector; 
    8993    } 
  • trunk/src/main/php/net/stubbles/ioc/stubBinding.php

    r1009 r1127  
    1414 * @subpackage  ioc 
    1515 */ 
    16 interface stubBinding extends stubObject { 
    17  
     16interface stubBinding extends stubObject 
     17
    1818    /** 
    1919     * Set the name of the injection 
  • trunk/src/main/php/net/stubbles/ioc/stubBindingModule.php

    r1009 r1127  
    1414 * @subpackage  ioc 
    1515 */ 
    16 interface stubBindingModule extends stubObject { 
    17  
     16interface stubBindingModule extends stubObject 
     17
    1818    /** 
    1919     * Configure the binder 
  • trunk/src/main/php/net/stubbles/ioc/stubBindingScope.php

    r1025 r1127  
    1616 * @subpackage  ioc 
    1717 */ 
    18 interface stubBindingScope extends stubObject { 
     18interface stubBindingScope extends stubObject 
     19
     20    /** 
     21     * returns the instance from the scope 
     22     * 
     23     * @param   stubReflectionClass    $type      type of the object 
     24     * @param   stubReflectionClass    $impl      concrete implementation 
     25     * @param   stubInjectionProvider  $provider 
     26     * @return  object 
     27     */ 
    1928    public function getInstance(stubReflectionClass $type, stubReflectionClass $impl, stubInjectionProvider $provider); 
    2029} 
  • trunk/src/main/php/net/stubbles/ioc/stubBindingScopeSingleton.php

    r1025 r1127  
    77 * @subpackage  ioc 
    88 */ 
    9  
    109stubClassLoader::load('net.stubbles.ioc.stubBindingScope', 
    1110                      'net.stubbles.reflection.stubReflectionClass' 
    1211); 
    13  
    1412/** 
    1513 * Scope for singletons 
     
    1816 * @subpackage  ioc 
    1917 */ 
    20 class stubBindingScopeSingleton extends stubBaseObject implements stubBindingScope { 
    21  
     18class stubBindingScopeSingleton extends stubBaseObject implements stubBindingScope 
     19
    2220    /** 
    2321     * Instances in this scope 
     
    3028     * Create the instance, if it has not been created before 
    3129     * 
    32      * @param stubReflectionClass $type type of the object 
    33      * @param stubReflectionClass $impl concrete implementation 
    34      * @param stubInjectionProvider $provider 
    35      * @return object 
     30     * @param   stubReflectionClass    $type      type of the object 
     31     * @param   stubReflectionClass    $impl      concrete implementation 
     32     * @param   stubInjectionProvider $provider 
     33     * @return object 
    3634     */ 
    37     public function getInstance(stubReflectionClass $type, stubReflectionClass $impl, stubInjectionProvider $provider) { 
     35    public function getInstance(stubReflectionClass $type, stubReflectionClass $impl, stubInjectionProvider $provider) 
     36    { 
    3837        $key = $impl->getName(); 
    3938        if (!isset($this->instances[$key])) { 
    4039            $this->instances[$key] = $provider->get($type); 
    4140        } 
     41         
    4242        return $this->instances[$key]; 
    4343    } 
  • trunk/src/main/php/net/stubbles/ioc/stubBindingScopes.php

    r1022 r1127  
    77 * @subpackage  ioc 
    88 */ 
    9  
    109stubClassLoader::load('net.stubbles.ioc.stubBindingScopeSingleton'); 
    11  
    1210/** 
    1311 * All built-in scopes 
     
    1614 * @subpackage  ioc 
    1715 */ 
    18 class stubBindingScopes extends stubBaseObject { 
    19  
     16class stubBindingScopes extends stubBaseObject 
     17
    2018    /** 
    2119     * Scope for singleton objects 
     
    2826     * Initialize all built-in scopes 
    2927     */ 
    30     public static function __static() { 
     28    public static function __static() 
     29    { 
    3130        self::$SINGLETON = new stubBindingScopeSingleton(); 
    3231    } 
  • trunk/src/main/php/net/stubbles/ioc/stubClassBinding.php

    r1025 r1127  
    1717 * @subpackage  ioc 
    1818 */ 
    19 class stubClassBinding extends stubBaseObject implements stubBinding { 
    20  
     19class stubClassBinding extends stubBaseObject implements stubBinding 
     20
    2121    /** 
    2222     * The injector used by this binding 
     
    2525     */ 
    2626    protected $injector = null; 
    27  
    2827    /** 
    2928     * The type for this binding 
     
    3231     */ 
    3332    protected $type = null; 
    34  
    3533    /** 
    3634     * The class that implements this binding 
     
    3937     */ 
    4038    protected $impl = null; 
    41  
    4239    /** 
    4340     * Annotated with a name 
     
    4643     */ 
    4744    protected $name = null; 
    48  
    4945    /** 
    5046     * Scope of the binding 
     
    5349     */ 
    5450    protected $scope = null; 
    55  
    5651    /** 
    5752     * Instance this type is bound to 
     
    6055     */ 
    6156    protected $instance = null; 
    62  
    6357    /** 
    6458     * The provider to use for this binding 
     
    6963 
    7064    /** 
    71      * Create a new binding 
    72      * 
    73      * @param stubInjector $injector 
    74      * @param string $type 
    75      */ 
    76     public function __construct($injector, $type) { 
     65     * constructor 
     66     * 
     67     * @param  stubInjector  $injector 
     68     * @param  string        $type 
     69     */ 
     70    public function __construct($injector, $type) 
     71    { 
    7772        $this->injector = $injector; 
    7873        $this->type     = $type; 
     
    8378     * Get the scope of the binding 
    8479     * 
    85      * @return stubBindingScope 
    86      */ 
    87     public function getScope() { 
     80     * @return  stubBindingScope 
     81     */ 
     82    public function getScope() 
     83    { 
    8884        return $this->scope; 
    8985    } 
     
    9288     * Set the concrete implementation 
    9389     * 
    94      * @param stubReflectionClass|string $impl 
    95      * @return stubBinding 
    96      */ 
    97     public function to($impl) { 
     90     * @param   stubReflectionClass|string  $impl 
     91     * @return  stubBinding 
     92     */ 
     93    public function to($impl) 
     94    { 
    9895        $this->impl = $impl; 
    9996        return $this; 
     
    103100     * Set the concrete instance 
    104101     * 
    105      * @param object $impl 
    106      * @return stubBinding 
    107      */ 
    108     public function toInstance($instance) { 
    109         if (!$instance instanceof $this->type) { 
     102     * @param   object       $impl 
     103     * @return  stubBinding 
     104     * @throws  stubIllegalArgumentException 
     105     */ 
     106    public function toInstance($instance) 
     107    { 
     108        if (($instance instanceof $this->type) === false) { 
    110109            throw new stubIllegalArgumentException("Instance of {$this->type} expectected, " . get_class($instance) . " given."); 
    111110        } 
     111         
    112112        $this->instance = $instance; 
    113113        return $this; 
     
    121121     * 'toInstance()' method. 
    122122     * 
    123      * @param stubInjectionProvider 
    124      * @return stubBinding 
    125      */ 
    126     public function toProvider(stubInjectionProvider $provider) { 
     123     * @param   stubInjectionProvider 
     124     * @return  stubBinding 
     125     */ 
     126    public function toProvider(stubInjectionProvider $provider) 
     127    { 
    127128        $this->provider = $provider; 
    128129        return $this; 
     
    132133     * Set the scope 
    133134     * 
    134      * @param stubBindingScope $scope 
    135      * @return stubBinding 
    136      */ 
    137     public function in(stubBindingScope $scope) { 
     135     * @param   stubBindingScope  $scope 
     136     * @return  stubBinding 
     137     */ 
     138    public function in(stubBindingScope $scope) 
     139    { 
    138140        $this->scope = $scope; 
    139141        return $this; 
     
    143145     * Set the name of the injection 
    144146     * 
    145      * @param string $name 
    146      * @return stubBinding 
    147      */ 
    148     public function named($name) { 
     147     * @param   string       $name 
     148     * @return  stubBinding 
     149     */ 
     150    public function named($name) 
     151    { 
    149152        $this->name = $name; 
    150153        return $this; 
     
    158161     * using the create() method. 
    159162     * 
    160      * @return object 
    161      * @see    create() 
    162      */ 
    163     public function getInstance() { 
    164         if ($this->instance != null) { 
     163     * @return  object 
     164     * @see     create() 
     165     */ 
     166    public function getInstance() 
     167    { 
     168        if (null !== $this->instance) { 
    165169            return $this->instance; 
    166170        } 
    167171 
    168         if (is_string($this->impl)) { 
     172        if (is_string($this->impl) === true) { 
    169173            $this->impl = new stubReflectionClass($this->impl); 
    170174        } 
    171175 
    172         if ($this->scope === null) { 
     176        if (null === $this->scope) { 
    173177            if ($this->impl->hasAnnotation('Singleton')) { 
    174178                $this->scope = stubBindingScopes::$SINGLETON; 
     
    176180        } 
    177181 
    178         if ($this->provider === null) { 
     182        if (null === $this->provider) { 
    179183            $this->provider = new stubDefaultInjectionProvider($this->injector, $this->impl); 
    180184        } 
    181185 
    182         if ($this->scope != null) { 
     186        if (null !== $this->scope) { 
    183187            return $this->scope->getInstance(new stubReflectionClass($this->type), $this->impl, $this->provider); 
    184188        } 
     189         
    185190        return $this->provider->get(new stubReflectionClass($this->type)); 
    186191    } 
     
    188193    /** 
    189194     * Creates a unique key for this binding 
    190      */ 
    191     public function getKey() { 
    192         if ($this->name === null) { 
     195     * 
     196     * @return  string 
     197     */ 
     198    public function getKey() 
     199    { 
     200        if (null === $this->name) { 
    193201            return $this->type; 
    194202        } 
     203         
    195204        return $this->type . '#' . $this->name; 
    196205    } 
  • trunk/src/main/php/net/stubbles/ioc/stubConstantBinding.php

    r1009 r1127  
    1414 * @subpackage  ioc 
    1515 */ 
    16 class stubConstantBinding extends stubBaseObject implements stubBinding { 
    17  
     16class stubConstantBinding extends stubBaseObject implements stubBinding 
     17
    1818    /** 
    1919     * This string is used when generating the key 
     
    2121     */ 
    2222    const TYPE = '__CONSTANT__'; 
    23  
    2423    /** 
    2524     * The injector used by this binding 
    2625     * 
    27      * @var stubInjector 
     26     * @var stubInjector 
    2827     */ 
    2928    protected $injector = null; 
    30  
    3129    /** 
    3230     * Annotated with a name 
    3331     * 
    34      * @var string 
     32     * @var string 
    3533     */ 
    3634    protected $name = null; 
    37  
    3835    /** 
    3936     * Instance this type is bound to 
    4037     * 
    41      * @var object 
     38     * @var object 
    4239     */ 
    4340    protected $value = null; 
    4441 
    4542    /** 
    46      * Create a new binding 
     43     * constructor 
    4744     * 
    48      * @param stubInjector $injector 
     45     * @param stubInjector $injector 
    4946     */ 
    50     public function __construct($injector) { 
     47    public function __construct($injector) 
     48    { 
    5149        $this->injector = $injector; 
    5250    } 
     
    5553     * Set the constant value 
    5654     * 
    57      * @param  mixed 
    58      * @return stubBinding 
     55     * @param  mixed 
     56     * @return stubBinding 
    5957     */ 
    60     public function to($value) { 
     58    public function to($value) 
     59    { 
    6160        $this->value = $value; 
    6261        return $this; 
     
    6665     * Set the name of the injection 
    6766     * 
    68      * @param string $name 
    69      * @return stubBinding 
     67     * @param   string      $name 
     68     * @return stubBinding 
    7069     */ 
    71     public function named($name) { 
     70    public function named($name) 
     71    { 
    7272        $this->name = $name; 
    7373        return $this; 
     
    7777     * Get the instance for this binding 
    7878     * 
    79      * @return object 
     79     * @return object 
    8080     */ 
    81     public function getInstance() { 
     81    public function getInstance() 
     82    { 
    8283        return $this->value; 
    8384    } 
     
    8586    /** 
    8687     * Creates a unique key for this binding 
     88     * 
     89     * @return  string 
    8790     */ 
    88     public function getKey() { 
     91    public function getKey() 
     92    { 
    8993        return self::TYPE . '#' . $this->name; 
    9094    } 
     
    9397     * Constant bindings have no scope 
    9498     * 
    95      * @return stubBindingScope 
     99     * @return stubBindingScope 
    96100     */ 
    97     public function getScope() { 
     101    public function getScope() 
     102    { 
    98103        return null; 
    99104    }