Changeset 984

Show
Ignore:
Timestamp:
10/25/07 15:07:14 (10 months ago)
Author:
mikey
Message:

various code improvements

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/experiments/people/mikey/prototype/stubPrototype.php

    r472 r984  
    191191        $modifiers = explode(' ', $modifier); 
    192192        foreach ($modifiers as $checkModifier) { 
    193            if (in_array($checkModifier, $allowedModifiers) == false) { 
    194                throw new stubIllegalArgumentException('The modifier argument contains the illegal modifier ' . $checkModifier); 
    195            
     193            if (in_array($checkModifier, $allowedModifiers) == false) { 
     194                throw new stubIllegalArgumentException('The modifier argument contains the illegal modifier ' . $checkModifier); 
     195           
    196196        } 
    197197         
     
    212212        if (count($arguments) > 0) { 
    213213            $paramString = ''; 
    214             foreach ($arguments as $key => $argument) { 
    215                $paramString .= ', $arguments[' . $key . ']'; 
     214            foreach (array_keys($arguments) as $key) { 
     215                $paramString .= ', $arguments[' . $key . ']'; 
    216216            } 
    217217             
     
    306306         
    307307        foreach ($this->methods as $methodName => $methodData) { 
    308            $class .= "\n    " . $methodData['comment'] . "\n    "; 
    309            $class .= $methodData['modifier'] . ' function ' . $methodName . '('; 
    310            $class .= join(', ', $methodData['arguments']) . ")\n    {\n        " . join("\n        ", explode("\n", $methodData['body'])); 
    311            $class .= "\n    }\n"; 
     308            $class .= "\n    " . $methodData['comment'] . "\n    "; 
     309            $class .= $methodData['modifier'] . ' function ' . $methodName . '('; 
     310            $class .= join(', ', $methodData['arguments']) . ")\n    {\n        " . join("\n        ", explode("\n", $methodData['body'])); 
     311            $class .= "\n    }\n"; 
    312312        } 
    313313 
  • trunk/src/main/php/info/phing/tasks/stubJsMinTask.php

    r787 r984  
    101101        } 
    102102         
    103         $error = false; 
    104103        foreach ($this->filesets as $fs) { 
    105104            try { 
     
    116115                        file_put_contents($target, JSMin::minify(file_get_contents($fullPath . '/' . $file))); 
    117116                    } catch (JSMinException $jsme) { 
    118                         $error = true; 
    119117                        $this->log("Could not minify file $file: " . $jsme->getMessage(), Project::MSG_ERR); 
    120118                    } 
  • trunk/src/main/php/net/stubbles/events/stubEventDispatcher.php

    r176 r984  
    7777    public static function getInstance($name = '__global') 
    7878    { 
    79         if (isset(self::$instances[$name]) == false) { 
     79        if (isset(self::$instances[$name]) === false) { 
    8080            self::$instances[$name] = new self($name); 
    8181        } 
     
    9191    public static function destroyInstance($name) 
    9292    { 
    93         if (isset(self::$instances[$name]) == true) { 
     93        if (isset(self::$instances[$name]) === true) { 
    9494            foreach (self::$instances as $eventDispatcher) { 
    9595                if ($eventDispatcher->hasParentDispatcher()) { 
    96                     if ($eventDispatcher->getParentDispatcher()->getName() == $name) { 
     96                    if ($eventDispatcher->getParentDispatcher()->getName() === $name) { 
    9797                        $eventDispatcher->removeParentDispatcher(); 
    9898                    } 
     
    161161    { 
    162162        $notified = $this->propagateQueuedEvents($eventListener, $eventName); 
    163         if (0 < $notified && $eventListener->autoremove() == true) { 
     163        if (0 < $notified && $eventListener->autoremove() === true) { 
    164164            return; 
    165165        } 
    166166         
    167         if (isset($this->listeners[$eventName]) == false) { 
     167        if (isset($this->listeners[$eventName]) === false) { 
    168168            $this->listeners[$eventName] = array(); 
    169169        } 
     
    180180    public function remove(stubEventListener $eventListener, $eventName) 
    181181    { 
    182         if (isset($this->listeners[$eventName]) == false || count($this->listeners[$eventName]) == 0) { 
     182        if (isset($this->listeners[$eventName]) === false || count($this->listeners[$eventName]) === 0) { 
    183183            return; 
    184184        } 
    185185         
    186         if (isset($this->listeners[$eventName][get_class($eventListener)]) == true) { 
     186        if (isset($this->listeners[$eventName][get_class($eventListener)]) === true) { 
    187187            unset($this->listeners[$eventName][get_class($eventListener)]); 
    188188        } 
     
    197197    public function has(stubEventListener $eventListener, $eventName) 
    198198    { 
    199         if (isset($this->listeners[$eventName]) == false || count($this->listeners[$eventName]) == 0) { 
     199        if (isset($this->listeners[$eventName]) === false || count($this->listeners[$eventName]) === 0) { 
    200200            return false; 
    201201        } 
     
    233233    { 
    234234        $eventName = $event->getName(); 
    235         if (isset($this->listeners[$eventName]) == true && count($this->listeners[$eventName]) > 0) { 
     235        if (isset($this->listeners[$eventName]) === true && count($this->listeners[$eventName]) > 0) { 
    236236            foreach ($this->listeners[$eventName] as $eventListenerClassName => $eventListener) { 
    237                 $this->listeners[$eventName][$eventListenerClassName]->handleEvent($event); 
     237                $eventListener->handleEvent($event); 
    238238                 
    239                 if (true == $this->listeners[$eventName][$eventListenerClassName]->autoremove()) { 
     239                if (true === $eventListener->autoremove()) { 
    240240                    unset($this->listeners[$eventName][$eventListenerClassName]); 
    241241                } 
     
    247247        } 
    248248         
    249         if (true == $queue) { 
     249        if (true === $queue) { 
    250250            $this->queue[] = $event; 
    251251        } 
    252252         
    253         if (true == $bubble && null !== $this->parentDispatcher) { 
     253        if (true === $bubble && null !== $this->parentDispatcher) { 
    254254            $this->parentDispatcher->triggerEvent($event, $queue); 
    255255        } 
     
    307307            // if event listener is restricted to a special event 
    308308            // and this event is not the special event skip this event 
    309             if (null != $eventName && $event->getName() != $eventName) { 
     309            if (null !== $eventName && $event->getName() !== $eventName) { 
    310310                continue; 
    311311            } 
     
    314314            $notified++; 
    315315             
    316             if ($event->isCancelled() == true) { 
     316            if ($event->isCancelled() === true) { 
    317317                unset($this->queue[$key]); 
    318318            } 
    319319             
    320             if ($eventListener->autoremove() == true) { 
     320            if ($eventListener->autoremove() === true) { 
    321321                break; 
    322322            } 
  • trunk/src/main/php/net/stubbles/ipo/request/stubRequestValueError.php

    r777 r984  
    9292    public function getMessage($locale) 
    9393    { 
    94         if (isset($this->messages[$locale]) == true) { 
     94        if (isset($this->messages[$locale]) === true) { 
    9595            $message = $this->messages[$locale]; 
    9696            foreach ($this->values as $key => $value) { 
     
    132132    protected function flattenValue($value) 
    133133    { 
    134         if (is_array($value) == true) { 
     134        if (is_array($value) === true) { 
    135135            $value = join(', ', $value); 
    136         } elseif (is_object($value) == true) { 
     136        } elseif (is_object($value) === true) { 
    137137            if (method_exists($value, '__toString') == false) { 
    138138                $value = get_class($value); 
     
    158158    public function setValues(array $values) 
    159159    { 
    160         foreach ($this->values as $key => $value) { 
    161             if (isset($values[$key]) == false) { 
     160        foreach (array_keys($this->values) as $key) { 
     161            if (isset($values[$key]) === false) { 
    162162                throw new stubRequestValueErrorException('Value for key ' . $key . ' is missing.'); 
    163163            } 
  • trunk/src/main/php/net/stubbles/ipo/session/resourcemanager/stubSessionResourceManager.php

    r914 r984  
    7676    public function get(stubReflectionClass $type) { 
    7777        $typeName = $type->getName(); 
    78         foreach ($this->resourceDefinitions as $interface => $implementation) { 
     78        foreach (array_keys($this->resourceDefinitions) as $interface) { 
    7979            $localName = substr($interface, strrpos($interface, '.')+1); 
    8080            if ($localName === $typeName) { 
     
    9797        $implementation = $this->getImplementation($interface); 
    9898 
    99         if (isset($this->resources[$implementation])) { 
     99        if (isset($this->resources[$implementation]) === true) { 
    100100            return $this->resources[$implementation]; 
    101101        } 
    102102 
    103103        $sessionKey = 'net.stubbles.ipo.session.resourcemanager#'.$implementation; 
    104         if ($this->session->hasValue($sessionKey)) { 
     104        if ($this->session->hasValue($sessionKey) === true) { 
    105105            $this->resources[$implementation] = $this->session->getValue($sessionKey); 
    106106            return $this->resources[$implementation]; 
     
    123123     */ 
    124124    protected function getFullQualifiedInterfaceName($interface) { 
    125         if (is_string($interface)) { 
     125        if (is_string($interface) === true) { 
    126126            return $interface; 
    127127        } 
    128128        if ($interface instanceof stubReflectionClass) { 
    129             if (!$interface->isInterface()) { 
     129            if ($interface->isInterface() === false) { 
    130130                throw new stubIllegalArgumentException($interface->getFullQualifiedClassName . ' is no interface.'); 
    131131            } 
     
    154154     */ 
    155155    protected function getImplementation($interface) { 
    156         if (!isset($this->resourceDefinitions[$interface])) { 
     156        if (isset($this->resourceDefinitions[$interface]) === false) { 
    157157            throw new stubException('Resource ' . $interface . ' is not availabale.'); 
    158158        } 
     
    179179     */ 
    180180    public function registerBindings(stubBinder $binder) { 
    181         foreach ($this->resourceDefinitions as $interface => $impl) { 
    182             $localName = substr($interface, strrpos($interface, '.')+1); 
     181        foreach (array_keys($this->resourceDefinitions) as $interface) { 
     182            $localName = substr($interface, strrpos($interface, '.') + 1); 
    183183            $binder->bind($localName)->toProvider($this); 
    184184        } 
  • trunk/src/main/php/net/stubbles/php/string/stubMd5Encoder.php

    r966 r984  
    3636    public function decode($string) 
    3737    { 
    38         throw new stubMethodNotSupportedException('Can not decode an md5-encoded string, encoding is not reversible.'); 
     38        throw new stubMethodNotSupportedException('Can not decode md5-encoded string ' . $string . ', encoding is not reversible.'); 
    3939    } 
    4040 
  • trunk/src/main/php/net/stubbles/rdbms/querybuilder/stubDatabaseMySQLQueryBuilder.php

    r898 r984  
    6363    { 
    6464        $selectQuery = 'SELECT * FROM `' . $select->getBaseTableName() . '`'; 
    65         if ($select->hasJoins() == true) { 
     65        if ($select->hasJoins() === true) { 
    6666            $joins = $select->getJoins(); 
    6767            foreach ($joins as $join) { 
    6868                $selectQuery .= ' ' . $join->getType(); 
    69                 $selectQuery .= (($join->getType() != 'STRAIGHT') ? (' ') : ('_')); 
     69                $selectQuery .= (($join->getType() !== 'STRAIGHT') ? (' ') : ('_')); 
    7070                $selectQuery .= 'JOIN `' . $join->getName() . '`'; 
    71                 if ($join->hasCondition() == true) { 
     71                if ($join->hasCondition() === true) { 
    7272                    $selectQuery .= ' ' . $join->getConditionType() . ' '; 
    73                     if ($join->getConditionType() == 'USING') { 
     73                    if ($join->getConditionType() === 'USING') { 
    7474                        $selectQuery .= '(' . $join->getCondition() . ')'; 
    7575                    } else { 
     
    8080        } 
    8181         
    82         if ($select->hasCriterion() == true) { 
     82        if ($select->hasCriterion() === true) { 
    8383            $selectQuery .= ' WHERE ' . $select->getCriterion()->toSQL(); 
    8484        } 
     
    9898        $queries = array(); 
    9999        foreach ($tableRows as $tableName => $tableRow) { 
    100             if (($tableRow instanceof stubDatabaseTableRow) == false) { 
     100            if (($tableRow instanceof stubDatabaseTableRow) === false) { 
    101101                throw new stubIllegalArgumentException('Table row for table ' . $tableName . ' is not an instance of net.stubbles.querybuilder.stubDatabaseTableRow.'); 
    102102            } 
     
    112112                if (null === $columnValue) { 
    113113                    $queries[$tableName] .= 'NULL'; 
    114                 } elseif (is_int($columnValue) == true) { 
     114                } elseif (is_int($columnValue) === true) { 
    115115                    $queries[$tableName] .= $columnValue; 
    116116                } else { 
     
    138138        $queries    = array(); 
    139139        foreach ($tableRows as $tableName => $tableRow) { 
    140             if (($tableRow instanceof stubDatabaseTableRow) == false) { 
     140            if (($tableRow instanceof stubDatabaseTableRow) === false) { 
    141141                throw new stubIllegalArgumentException('Table row for table ' . $tableName . ' is not an instance of net.stubbles.querybuilder.stubDatabaseTableRow.'); 
    142142            } 
     
    144144            $tableName           = $tableRow->getTableName(); 
    145145            $queries[$tableName] = 'UPDATE `' . $tableName . '` SET '; 
    146             $where               = array(); 
    147146            $counter             = 0; 
    148147            foreach ($tableRow->getColumns() as $columnName => $columnValue) { 
     
    154153                if (null === $columnValue) { 
    155154                    $queries[$tableName] .= 'NULL'; 
    156                 } elseif (is_int($columnValue) == true) { 
     155                } elseif (is_int($columnValue) === true) { 
    157156                    $queries[$tableName] .= $columnValue; 
    158157                } else { 
     
    163162            } 
    164163             
    165             if ($tableRow->hasCriterion() == true) { 
     164            if ($tableRow->hasCriterion() === true) { 
    166165                $queries[$tableName] .= ' WHERE ' . $tableRow->getCriterion()->toSQL(); 
    167166            } 
     
    191190    public function createTable(stubDatabaseTableDescription $tableDescription) 
    192191    { 
    193         $query       = 'CREATE TABLE `' . $tableDescription->getName() . "` (\n"; 
    194         $columns     = $tableDescription->getColumns(); 
    195         if (count($columns) == 0) { 
     192        $query   = 'CREATE TABLE `' . $tableDescription->getName() . "` (\n"; 
     193        $columns = $tableDescription->getColumns(); 
     194        if (count($columns) === 0) { 
    196195            throw new stubDatabaseQueryBuilderException('A table must contain at least one column, but description for table ' . $tableDescription->getName() . ' does not contain any column.'); 
    197196        } 
     
    207206            $counter++; 
    208207            $query   .= '  ' . $column->getName() . ' ' . strtoupper($column->getType()); 
    209             if (strtoupper($column->getType()) != 'TEXT') { 
     208            if (strtoupper($column->getType()) !== 'TEXT') { 
    210209                $query   .= '(' . $column->getSize() . ')'; 
    211210            } 
    212211             
    213             if ($this->isTextColumn($column->getType()) == true) { 
    214                 if ($column->hasCharacterSet() == true) { 
     212            if ($this->isTextColumn($column->getType()) === true) { 
     213                if ($column->hasCharacterSet() === true) { 
    215214                    $query .= ' CHARACTER SET ' . $column->getCharacterSet(); 
    216215                } 
    217216                 
    218                 if ($column->hasCollation() == true) { 
     217                if ($column->hasCollation() === true) { 
    219218                    $query .= ' COLLATE ' . $column->getCollation(); 
    220219                } 
    221             } elseif ($this->isNumericColumn($column->getType()) == true) { 
     220            } elseif ($this->isNumericColumn($column->getType()) === true) { 
    222221                if ($column->isUnsigned() == true) { 
    223222                    $query .= ' UNSIGNED'; 
     
    229228            } 
    230229             
    231             if ($column->isNullable() == true && $column->getDefaultValue() == null) { 
     230            if ($column->isNullable() === true && $column->getDefaultValue() === null) { 
    232231                $query .= ' DEFAULT NULL'; 
    233232            } else { 
     
    241240            } 
    242241             
    243             if ($column->isPrimaryKey() == true) { 
     242            if ($column->isPrimaryKey() === true) { 
    244243                if ($this->isNumericColumn($column->getType()) === true) { 
    245244                    $query .= ' AUTO_INCREMENT'; 
     
    247246                 
    248247                $primaryKeys[] = $column->getName(); 
    249             } elseif ($column->isKey() == true) { 
     248            } elseif ($column->isKey() === true) { 
    250249                $keys[] = $column->getName(); 
    251250            } 
  • trunk/src/main/php/net/stubbles/reflection/annotations/stubAnnotationFactory.php

    r834 r984  
    5252    public static function create($comment, $annotationName, $target, $targetName, $fileName) 
    5353    { 
    54         if (stubAnnotationCache::has($target, $fileName . '::' . $targetName, $annotationName)) { 
    55             return $cachedAnnotation = stubAnnotationCache::get($target, $fileName . '::' . $targetName, $annotationName); 
     54        if (stubAnnotationCache::has($target, $fileName . '::' . $targetName, $annotationName) === true) { 
     55            return stubAnnotationCache::get($target, $fileName . '::' . $targetName, $annotationName); 
    5656        } 
    5757 
    5858        $hash = md5($fileName . $comment . $target . $targetName); 
    59         if (isset(self::$annotations[$hash]) == false) { 
    60             if (null == self::$parser) { 
     59        if (isset(self::$annotations[$hash]) === false) { 
     60            if (null === self::$parser) { 
    6161                stubClassLoader::load('net.stubbles.reflection.annotations.parser.stubAnnotationStateParser'); 
    6262                self::$parser = new stubAnnotationStateParser(); 
     
    6666        } 
    6767 
    68         if (isset(self::$annotations[$hash][$annotationName]) == false) { 
     68        if (isset(self::$annotations[$hash][$annotationName]) === false) { 
    6969            throw new ReflectionException('Can not find annotation ' . $annotationName); 
    7070        } 
     
    7373        $annotation      = new $annotationClass(); 
    7474 
    75         if (($annotation instanceof stubAnnotation) == false) { 
     75        if (($annotation instanceof stubAnnotation) === false) { 
    7676            throw new ReflectionException('The annotation: ' . $annotationName . ' is not an instance of net.stubbles.reflection.annotations.stubAnnotation.'); 
    7777        } 
    7878         
    79         if (self::$annotations[$hash][$annotationName]['type'] != $annotationName) { 
     79        if (self::$annotations[$hash][$annotationName]['type'] !== $annotationName) { 
    8080            $annotationType = self::findAnnotationClass($annotationName, true); 
    81             if (is_a($annotation, $annotationType) == false) { 
     81            if (is_a($annotation, $annotationType) === false) { 
    8282                throw new ReflectionException('The annotation: ' . $annotationName . ' is not an instance of ' . $annotationType . '.'); 
    8383            } 
    8484        } 
    8585         
    86         if (self::isApplicable($annotation, $target) == false) { 
     86        if (self::isApplicable($annotation, $target) === false) { 
    8787            throw new ReflectionException('The annotation: ' . $annotationName . ' is not applicable for the given type.'); 
    8888        } 
     
    103103    public static function isApplicable(stubAnnotation $annotation, $target) 
    104104    { 
    105         return (($annotation->getAnnotationTarget() & $target) != 0); 
     105        return (($annotation->getAnnotationTarget() & $target) !== 0); 
    106106    } 
    107107 
     
    117117        $refClass = new ReflectionClass($annotation); 
    118118        foreach ($data as $name => $value) { 
    119             if ($refClass->hasMethod('set' . ucfirst($name)) == true) { 
     119            if ($refClass->hasMethod('set' . ucfirst($name)) === true) { 
    120120                $refClass->getMethod('set' . ucfirst($name))->invoke($annotation, $value); 
    121             } elseif ($refClass->hasProperty($name) == true) { 
     121            } elseif ($refClass->hasProperty($name) === true) { 
    122122                $refClass->getProperty($name)->setValue($annotation, $value); 
    123123            } else { 
     
    141141    public static function has($comment, $annotationName, $target, $targetName, $fileName) 
    142142    { 
    143         $annotation = null; 
    144143        try { 
    145144            $annotation = self::create($comment, $annotationName, $target, $targetName, $fileName); 
    146145        } catch (ReflectionException $e) { 
     146            $annotation = null; 
    147147        } 
    148148 
     
    172172    private static function findAnnotationClass($annotationClass, $allowInterface = false) 
    173173    { 
    174         if (class_exists($annotationClass, false) == true) { 
     174        if (class_exists($annotationClass, false) === true) { 
    175175            return $annotationClass; 
    176176        } 
    177177         
    178         if (true == $allowInterface && interface_exists($annotationClass, false) == true) { 
     178        if (true === $allowInterface && interface_exists($annotationClass, false) === true) { 
    179179            return $annotationClass; 
    180180        } 
     
    182182        $annotationClassname = $annotationClass  . 'Annotation'; 
    183183        foreach (self::$prefixes as $prefix) { 
    184             if (class_exists($prefix . $annotationClassname) == true) { 
     184            if (class_exists($prefix . $annotationClassname) === true) { 
    185185                return $prefix . $annotationClassname; 
    186186            } 
    187187             
    188             if (true == $allowInterface && interface_exists($prefix . $annotationClassname, false) == true) { 
     188            if (true === $allowInterface && interface_exists($prefix . $annotationClassname, false) === true) { 
    189189                return $prefix . $annotationClassname; 
    190190            } 
  • trunk/src/main/php/net/stubbles/reflection/stubReflectionFunction.php

    r942 r984  
    7878    { 
    7979        if ($compare instanceof self) { 
    80             return ($compare->functionName == $this->functionName); 
     80            return ($compare->functionName === $this->functionName); 
    8181        } 
    8282         
     
    143143        $returnType  = trim($returnParts[0]); 
    144144        try { 
    145             return stubReflectionPrimitive::forName(new ReflectionClass('stubReflectionPrimitive'), $returnType); 
     145            $reflectionType = stubReflectionPrimitive::forName(new ReflectionClass('stubReflectionPrimitive'), $returnType); 
    146146        } catch (stubIllegalArgumentException $iae) { 
    147             return new stubReflectionClass($returnType); 
     147            $reflectionType = new stubReflectionClass($returnType); 
    148148        } 
     149         
     150        return $reflectionType; 
    149151    } 
    150152} 
  • trunk/src/main/php/net/stubbles/reflection/stubReflectionMethod.php

    r942 r984  
    8686    { 
    8787        if ($compare instanceof self) { 
    88             return ($compare->className == $this->className && $compare->methodName == $this->methodName); 
     88            return ($compare->className === $this->className && $compare->methodName === $this->methodName); 
    8989        } 
    9090         
     
    163163        $returnType  = trim($returnParts[0]); 
    164164        try { 
    165             return stubReflectionPrimitive::forName(new ReflectionClass('stubReflectionPrimitive'), $returnType); 
     165            $reflectionType = stubReflectionPrimitive::forName(new ReflectionClass('stubReflectionPrimitive'), $returnType); 
    166166        } catch (stubIllegalArgumentException $iae) { 
    167             return new stubReflectionClass($returnType); 
     167            $reflectionType = new stubReflectionClass($returnType); 
    168168        } 
     169         
     170        return $reflectionType; 
    169171    } 
    170172} 
  • trunk/src/main/php/net/stubbles/service/jsonrpc/stubJsonRpcProcessor.php

    r964 r984  
    7878        $this->loadServiceConfig($this->getServiceFilePath()); 
    7979 
    80         if ($this->request->hasValue('__generateProxy')) { 
     80        if ($this->request->hasValue('__generateProxy') === true) { 
    8181            $proxyClassvalidator = new stubRegexValidator('/^[A-Za-z,0-9_\.]+$/'); 
    8282            $classes = $this->request->getValidatedValue($proxyClassvalidator, '__generateProxy', stubRequest::SOURCE_PARAM); 
    83             if ($classes === '__all') { 
     83            if ('__all' === $classes) { 
    8484                $this->generateProxies(); 
    8585            } else { 
    8686                $this->generateProxies(explode(',', $classes)); 
    8787            } 
    88         } elseif ($this->request->hasValue('__smd')) { 
     88        } elseif ($this->request->hasValue('__smd') === true) { 
    8989            $smdClassvalidator = new stubRegexValidator('/^[A-Za-z0-9_\.]+$/'); 
    9090            $class = $this->request->getValidatedValue($smdClassvalidator, '__smd', stubRequest::SOURCE_PARAM); 
     
    106106    { 
    107107        $configFile = stubConfig::getConfigPath() . '/xml/' . stubRegistry::getConfig(self::KEY_SERVICE_FILE,'json-rpc-service.xml'); 
    108         if (!file_exists($configFile) || !is_readable($configFile)) { 
     108        if (file_exists($configFile) === false || is_readable($configFile) === false) { 
    109109            stubClassLoader::load('net.stubbles.lang.exceptions.stubFileNotFoundException'); 
    110110            throw new stubFileNotFoundException($configFile); 
     
    122122    { 
    123123        $cacheFile = stubConfig::getCachePath() . '/jsonrpc_' . md5($serviceConfigFile) . '.cache'; 
    124         if (file_exists($cacheFile)) { 
     124        if (file_exists($cacheFile) === true) { 
    125125            $cacheData = unserialize(file_get_contents($cacheFile)); 
    126126            $this->classMap      = $cacheData['classMap']; 
    127127            $this->serviceConfig = $cacheData['serviceConfig']; 
    128             return true
     128            return
    129129        } 
    130130 
     
    163163        $generator = new stubJsonRpcProxyGenerator($serviceUrl); 
    164164        foreach ($this->classMap as $jsClass => $serviceConfig) { 
    165             if (is_array($classes) && !in_array($jsClass, $classes)) { 
     165            if (is_array($classes) === true && in_array($jsClass, $classes) === false) { 
    166166                continue; 
    167167            } 
     
    170170                $this->response->write($generator->generateJavascriptProxy($serviceConfig['className'], $jsClass)); 
    171171            } catch (Exception $e) { 
    172                 if ($this->serviceConfig['use-firebug'] === true) { 
     172                if (true === $this->serviceConfig['use-firebug']) { 
    173173                    $this->response->write("console.error('Generation of proxy for {$serviceConfig['className']} failed.');\n"); 
    174174                    $this->response->write($this->convertStringToFirebug($e->__toString())); 
     
    188188        $tmp        = parse_url($this->request->getURI()); 
    189189        $serviceUrl = '//' . $tmp['path']; 
    190         if ($this->request->hasValue('processor')) { 
     190        if ($this->request->hasValue('processor') === true) { 
    191191            $processor   = $this->request->getValidatedValue(new stubPassThruValidator(), 'processor', stubRequest::SOURCE_PARAM); 
    192192            $serviceUrl .= '?processor=' . $processor; 
     
    194194        } 
    195195        $generator = new stubSmdGenerator($serviceUrl); 
     196        $classInfo = $this->classMap[$class]; 
    196197        try { 
    197             $classInfo = $this->classMap[$class]; 
    198198            $this->response->write($generator->generateSmd($classInfo['className'], $class)); 
    199199        } catch (Exception $e) { 
    200             if ($this->serviceConfig['use-firebug'] === true) { 
    201                 $this->response->write("console.error('Generation of SMD for {$serviceConfig['className']} failed.');\n"); 
     200            if (true === $this->serviceConfig['use-firebug']) { 
     201                $this->response->write("console.error('Generation of SMD for {$classInfo['className']} failed.');\n"); 
    202202                $this->response->write($this->convertStringToFirebug($e->__toString())); 
    203203            } 
     
    234234        $requestJsonObj = $this->request->getValidatedRawData(new stubPassThruValidator()); 
    235235        $phpJsonObj     = json_decode($requestJsonObj); 
    236         if (!is_object($phpJsonObj)) { 
     236        if (is_object($phpJsonObj) === false) { 
    237237            $this->response->writeFault(null, 'Invalid request.'); 
    238238            return; 
    239239        } 
    240240 
    241         if (!isset($phpJsonObj->id)) { 
     241        if (isset($phpJsonObj->id) === false) { 
    242242            $this->response->writeFault(null, 'Invalid request: No id given.'); 
    243243            return; 
    244244        } 
    245245 
    246         if (!isset($phpJsonObj->method)) { 
     246        if (isset($phpJsonObj->method) === false) { 
    247247            $this->response->writeFault($phpJsonObj->id, 'Invalid request: No method given.'); 
    248248            return; 
    249249        } 
    250250 
    251         if (!isset($phpJsonObj->params)) { 
     251        if (isset($phpJsonObj->params) === false) { 
    252252            $this->response->writeFault($phpJsonObj->id, 'Invalid request: No params given.'); 
    253253            return; 
     
    256256        try { 
    257257            $className = null; 
    258             if ($this->request->hasValue('__class')) { 
     258            if ($this->request->hasValue('__class') === true) { 
    259259                $className = $this->request->getValidatedValue(new stubPassThruValidator(), '__class'); 
    260260            } 
     
    303303    protected function getClassAndMethod($methodName, $className = null) 
    304304    { 
    305         if ($className === null) { 
     305        if (null === $className) { 
    306306            if (!preg_match(self::CLASS_AND_METHOD_PATTERN, $methodName)) { 
    307307                throw new stubException('Invalid request: method-Pattern has to be <className>.<methodName>.'); 
     
    310310            list($className, $methodName) = explode('.', $methodName); 
    311311        } 
    312         if (!isset($this->classMap[$className])) { 
     312        if (isset($this->classMap[$className]) === false) { 
    313313            throw new stubException('Unknown class ' . $className . '.'); 
    314314        } 
    315315 
    316316        $clazz = new stubReflectionClass($this->classMap[$className]['className']); 
    317         if ($clazz->hasMethod($methodName) == false) { 
     317        if ($clazz->hasMethod($methodName) === false) { 
    318318            throw new stubException('Unknown method ' . $className . '.' . $methodName . '.'); 
    319319        } 
    320320 
    321321        $method = $clazz->getMethod($methodName); 
    322         if (!$method->hasAnnotation('WebMethod')) { 
     322        if ($method->hasAnnotation('WebMethod') === false) { 
    323323            throw new stubException('Method ' . $className . '.' . $methodName . ' is no WebMethod.'); 
    324324        } 
  • trunk/src/main/php/net/stubbles/star/StarClassRegistry.php

    r698 r984  
    6363        } 
    6464         
    65         if (isset(self::$classes[$fqClassName]) == true) { 
     65        if (isset(self::$classes[$fqClassName]) === true) { 
    6666            return self::$classes[$fqClassName]; 
    6767        } 
     
    8282        } 
    8383         
    84         if (isset(self::$classes[$fqClassName]) == true) { 
     84        if (isset(self::$classes[$fqClassName]) === true) { 
    8585            return 'star://' . self::$classes[$fqClassName] . '?' . $fqClassName; 
    8686        } 
     
    104104        foreach (self::$files as $file => $contents) { 
    105105            foreach ($contents as $content) { 
    106                 if ($content == $resource) { 
     106                if ($content === $resource) { 
    107107                    $uris[] = 'star://' . $file . '?' . $resource; 
    108108                    continue 2; 
     
    126126        } 
    127127         
    128         if (isset(self::$files[$file]) == true) { 
     128        if (isset(self::$files[$file]) === true) { 
    129129            return self::$files[$file]; 
    130130        } 
     
    153153 
    154154        if (count(self::$libPathes) == 0) { 
    155             if (substr(__FILE__, 0, 7) == 'star://') { 
     155            if (substr(__FILE__, 0, 7) === 'star://') { 
    156156                $path = str_replace('star://', '', str_replace('?net.stubbles.star.StarClassRegistry', '', __FILE__)); 
    157157                self::$libPathes[dirname($path)] = true; 
     
    162162 
    163163        foreach (self::$libPathes as $libPath => $recursive) { 
    164             if (file_exists($libPath . '/.cache') == true) { 
     164            if (file_exists($libPath . '/.cache') === true) { 
    165165                $cache = unserialize(file_get_contents($libPath . '/.cache')); 
    166166                self::$files    = array_merge(self::$files, $cache['files']); 
     
    179179            $cache['classes'] = array(); 
    180180            foreach ($dirIt as $file) { 
    181                 if ($file->isFile() == false || substr($file->getPathname(), -14) == 'starReader.php' || (substr($file->getPathname(), -5) != '.star' && substr($file->getPathname(), -4) != '.php')) { 
     181                if ($file->isFile() === false || substr($file->getPathname(), -14) === 'starReader.php' || (substr($file->getPathname(), -5) !== '.star' && substr($file->getPathname(), -4) !== '.php')) { 
    182182                    continue; 
    183183                } 
     
    192192                $cache['files'][$file->getPathname()] = $classes; 
    193193 
    194                 foreach ($archiveData['index'] as $fqClassName => $storeData) { 
     194                foreach (array_keys($archiveData['index']) as $fqClassName) { 
    195195                    self::$classes[$fqClassName]    = $file->getPathname(); 
    196196                    $cache['classes'][$fqClassName] = $file->getPathname(); 
     
    199199 
    200200            $cacheFile = $libPath . '/.cache'; 
    201             if (!is_writable($libPath) && !is_writable($cacheFile)) { 
     201            if (is_writable($libPath) === false && is_writable($cacheFile) === false) { 
    202202                throw new StarException("Unable to write starRegistry cache file to {$cacheFile}."); 
    203203            } 
     204             
    204205            file_put_contents($cacheFile, serialize($cache)); 
    205206            self::$initDone = true; 
  • trunk/src/main/php/net/stubbles/util/net/http/stubHTTPResponse.php

    r719 r984  
    117117            $header = ''; 
    118118            $line   = ''; 
    119             while ($this->socket->eof() == false && stubHTTPConnection::END_OF_LINE != $line) { 
     119            while ($this->socket->eof() === false && stubHTTPConnection::END_OF_LINE !== $line) { 
    120120                $line    = $this->socket->read(); 
    121121                $header .= $line; 
     
    123123             
    124124            $this->headers = stubHeaderList::fromString($header); 
    125             if ($this->headers->containsKey('Content-Length') == true) { 
     125            if ($this->headers->containsKey('Content-Length') === true) { 
    126126                $readLength = $this->headers->get('Content-Length'); 
    127127            } else { 
     
    131131            if (self::STATUS_CLASS_SUCCESS == $this->getType(self::TYPE_STATUS_CLASS)) { 
    132132                // if server sends chunked data 
    133                 if ($this->headers->containsKey('Transfer-Encoding') == true && $this->headers->get('Transfer-Encoding') == 'chunked') { 
     133        &n