Changeset 984
- Timestamp:
- 10/25/07 15:07:14 (10 months ago)
- Files:
-
- trunk/experiments/people/mikey/prototype/stubPrototype.php (modified) (3 diffs)
- trunk/src/main/php/info/phing/tasks/stubJsMinTask.php (modified) (2 diffs)
- trunk/src/main/php/net/stubbles/events/stubEventDispatcher.php (modified) (9 diffs)
- trunk/src/main/php/net/stubbles/ipo/request/stubRequestValueError.php (modified) (3 diffs)
- trunk/src/main/php/net/stubbles/ipo/session/resourcemanager/stubSessionResourceManager.php (modified) (5 diffs)
- trunk/src/main/php/net/stubbles/php/string/stubMd5Encoder.php (modified) (1 diff)
- trunk/src/main/php/net/stubbles/rdbms/querybuilder/stubDatabaseMySQLQueryBuilder.php (modified) (13 diffs)
- trunk/src/main/php/net/stubbles/reflection/annotations/stubAnnotationFactory.php (modified) (8 diffs)
- trunk/src/main/php/net/stubbles/reflection/stubReflectionFunction.php (modified) (2 diffs)
- trunk/src/main/php/net/stubbles/reflection/stubReflectionMethod.php (modified) (2 diffs)
- trunk/src/main/php/net/stubbles/service/jsonrpc/stubJsonRpcProcessor.php (modified) (11 diffs)
- trunk/src/main/php/net/stubbles/star/StarClassRegistry.php (modified) (9 diffs)
- trunk/src/main/php/net/stubbles/util/net/http/stubHTTPResponse.php (modified) (6 diffs)
- trunk/src/main/php/net/stubbles/websites/memphis/stubMemphisConfig.php (modified) (5 diffs)
- trunk/src/main/php/net/stubbles/websites/rasmus/stubRasmusProcessor.php (modified) (1 diff)
- trunk/src/main/php/net/stubbles/websites/variantmanager/types/stubAbstractVariant.php (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/experiments/people/mikey/prototype/stubPrototype.php
r472 r984 191 191 $modifiers = explode(' ', $modifier); 192 192 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 } 196 196 } 197 197 … … 212 212 if (count($arguments) > 0) { 213 213 $paramString = ''; 214 foreach ( $arguments as $key => $argument) {215 $paramString .= ', $arguments[' . $key . ']';214 foreach (array_keys($arguments) as $key) { 215 $paramString .= ', $arguments[' . $key . ']'; 216 216 } 217 217 … … 306 306 307 307 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"; 312 312 } 313 313 trunk/src/main/php/info/phing/tasks/stubJsMinTask.php
r787 r984 101 101 } 102 102 103 $error = false;104 103 foreach ($this->filesets as $fs) { 105 104 try { … … 116 115 file_put_contents($target, JSMin::minify(file_get_contents($fullPath . '/' . $file))); 117 116 } catch (JSMinException $jsme) { 118 $error = true;119 117 $this->log("Could not minify file $file: " . $jsme->getMessage(), Project::MSG_ERR); 120 118 } trunk/src/main/php/net/stubbles/events/stubEventDispatcher.php
r176 r984 77 77 public static function getInstance($name = '__global') 78 78 { 79 if (isset(self::$instances[$name]) == false) {79 if (isset(self::$instances[$name]) === false) { 80 80 self::$instances[$name] = new self($name); 81 81 } … … 91 91 public static function destroyInstance($name) 92 92 { 93 if (isset(self::$instances[$name]) == true) {93 if (isset(self::$instances[$name]) === true) { 94 94 foreach (self::$instances as $eventDispatcher) { 95 95 if ($eventDispatcher->hasParentDispatcher()) { 96 if ($eventDispatcher->getParentDispatcher()->getName() == $name) {96 if ($eventDispatcher->getParentDispatcher()->getName() === $name) { 97 97 $eventDispatcher->removeParentDispatcher(); 98 98 } … … 161 161 { 162 162 $notified = $this->propagateQueuedEvents($eventListener, $eventName); 163 if (0 < $notified && $eventListener->autoremove() == true) {163 if (0 < $notified && $eventListener->autoremove() === true) { 164 164 return; 165 165 } 166 166 167 if (isset($this->listeners[$eventName]) == false) {167 if (isset($this->listeners[$eventName]) === false) { 168 168 $this->listeners[$eventName] = array(); 169 169 } … … 180 180 public function remove(stubEventListener $eventListener, $eventName) 181 181 { 182 if (isset($this->listeners[$eventName]) == false || count($this->listeners[$eventName])== 0) {182 if (isset($this->listeners[$eventName]) === false || count($this->listeners[$eventName]) === 0) { 183 183 return; 184 184 } 185 185 186 if (isset($this->listeners[$eventName][get_class($eventListener)]) == true) {186 if (isset($this->listeners[$eventName][get_class($eventListener)]) === true) { 187 187 unset($this->listeners[$eventName][get_class($eventListener)]); 188 188 } … … 197 197 public function has(stubEventListener $eventListener, $eventName) 198 198 { 199 if (isset($this->listeners[$eventName]) == false || count($this->listeners[$eventName])== 0) {199 if (isset($this->listeners[$eventName]) === false || count($this->listeners[$eventName]) === 0) { 200 200 return false; 201 201 } … … 233 233 { 234 234 $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) { 236 236 foreach ($this->listeners[$eventName] as $eventListenerClassName => $eventListener) { 237 $ this->listeners[$eventName][$eventListenerClassName]->handleEvent($event);237 $eventListener->handleEvent($event); 238 238 239 if (true == $this->listeners[$eventName][$eventListenerClassName]->autoremove()) {239 if (true === $eventListener->autoremove()) { 240 240 unset($this->listeners[$eventName][$eventListenerClassName]); 241 241 } … … 247 247 } 248 248 249 if (true == $queue) {249 if (true === $queue) { 250 250 $this->queue[] = $event; 251 251 } 252 252 253 if (true == $bubble && null !== $this->parentDispatcher) {253 if (true === $bubble && null !== $this->parentDispatcher) { 254 254 $this->parentDispatcher->triggerEvent($event, $queue); 255 255 } … … 307 307 // if event listener is restricted to a special event 308 308 // 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) { 310 310 continue; 311 311 } … … 314 314 $notified++; 315 315 316 if ($event->isCancelled() == true) {316 if ($event->isCancelled() === true) { 317 317 unset($this->queue[$key]); 318 318 } 319 319 320 if ($eventListener->autoremove() == true) {320 if ($eventListener->autoremove() === true) { 321 321 break; 322 322 } trunk/src/main/php/net/stubbles/ipo/request/stubRequestValueError.php
r777 r984 92 92 public function getMessage($locale) 93 93 { 94 if (isset($this->messages[$locale]) == true) {94 if (isset($this->messages[$locale]) === true) { 95 95 $message = $this->messages[$locale]; 96 96 foreach ($this->values as $key => $value) { … … 132 132 protected function flattenValue($value) 133 133 { 134 if (is_array($value) == true) {134 if (is_array($value) === true) { 135 135 $value = join(', ', $value); 136 } elseif (is_object($value) == true) {136 } elseif (is_object($value) === true) { 137 137 if (method_exists($value, '__toString') == false) { 138 138 $value = get_class($value); … … 158 158 public function setValues(array $values) 159 159 { 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) { 162 162 throw new stubRequestValueErrorException('Value for key ' . $key . ' is missing.'); 163 163 } trunk/src/main/php/net/stubbles/ipo/session/resourcemanager/stubSessionResourceManager.php
r914 r984 76 76 public function get(stubReflectionClass $type) { 77 77 $typeName = $type->getName(); 78 foreach ( $this->resourceDefinitions as $interface => $implementation) {78 foreach (array_keys($this->resourceDefinitions) as $interface) { 79 79 $localName = substr($interface, strrpos($interface, '.')+1); 80 80 if ($localName === $typeName) { … … 97 97 $implementation = $this->getImplementation($interface); 98 98 99 if (isset($this->resources[$implementation]) ) {99 if (isset($this->resources[$implementation]) === true) { 100 100 return $this->resources[$implementation]; 101 101 } 102 102 103 103 $sessionKey = 'net.stubbles.ipo.session.resourcemanager#'.$implementation; 104 if ($this->session->hasValue($sessionKey) ) {104 if ($this->session->hasValue($sessionKey) === true) { 105 105 $this->resources[$implementation] = $this->session->getValue($sessionKey); 106 106 return $this->resources[$implementation]; … … 123 123 */ 124 124 protected function getFullQualifiedInterfaceName($interface) { 125 if (is_string($interface) ) {125 if (is_string($interface) === true) { 126 126 return $interface; 127 127 } 128 128 if ($interface instanceof stubReflectionClass) { 129 if ( !$interface->isInterface()) {129 if ($interface->isInterface() === false) { 130 130 throw new stubIllegalArgumentException($interface->getFullQualifiedClassName . ' is no interface.'); 131 131 } … … 154 154 */ 155 155 protected function getImplementation($interface) { 156 if ( !isset($this->resourceDefinitions[$interface])) {156 if (isset($this->resourceDefinitions[$interface]) === false) { 157 157 throw new stubException('Resource ' . $interface . ' is not availabale.'); 158 158 } … … 179 179 */ 180 180 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); 183 183 $binder->bind($localName)->toProvider($this); 184 184 } trunk/src/main/php/net/stubbles/php/string/stubMd5Encoder.php
r966 r984 36 36 public function decode($string) 37 37 { 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.'); 39 39 } 40 40 trunk/src/main/php/net/stubbles/rdbms/querybuilder/stubDatabaseMySQLQueryBuilder.php
r898 r984 63 63 { 64 64 $selectQuery = 'SELECT * FROM `' . $select->getBaseTableName() . '`'; 65 if ($select->hasJoins() == true) {65 if ($select->hasJoins() === true) { 66 66 $joins = $select->getJoins(); 67 67 foreach ($joins as $join) { 68 68 $selectQuery .= ' ' . $join->getType(); 69 $selectQuery .= (($join->getType() != 'STRAIGHT') ? (' ') : ('_'));69 $selectQuery .= (($join->getType() !== 'STRAIGHT') ? (' ') : ('_')); 70 70 $selectQuery .= 'JOIN `' . $join->getName() . '`'; 71 if ($join->hasCondition() == true) {71 if ($join->hasCondition() === true) { 72 72 $selectQuery .= ' ' . $join->getConditionType() . ' '; 73 if ($join->getConditionType() == 'USING') {73 if ($join->getConditionType() === 'USING') { 74 74 $selectQuery .= '(' . $join->getCondition() . ')'; 75 75 } else { … … 80 80 } 81 81 82 if ($select->hasCriterion() == true) {82 if ($select->hasCriterion() === true) { 83 83 $selectQuery .= ' WHERE ' . $select->getCriterion()->toSQL(); 84 84 } … … 98 98 $queries = array(); 99 99 foreach ($tableRows as $tableName => $tableRow) { 100 if (($tableRow instanceof stubDatabaseTableRow) == false) {100 if (($tableRow instanceof stubDatabaseTableRow) === false) { 101 101 throw new stubIllegalArgumentException('Table row for table ' . $tableName . ' is not an instance of net.stubbles.querybuilder.stubDatabaseTableRow.'); 102 102 } … … 112 112 if (null === $columnValue) { 113 113 $queries[$tableName] .= 'NULL'; 114 } elseif (is_int($columnValue) == true) {114 } elseif (is_int($columnValue) === true) { 115 115 $queries[$tableName] .= $columnValue; 116 116 } else { … … 138 138 $queries = array(); 139 139 foreach ($tableRows as $tableName => $tableRow) { 140 if (($tableRow instanceof stubDatabaseTableRow) == false) {140 if (($tableRow instanceof stubDatabaseTableRow) === false) { 141 141 throw new stubIllegalArgumentException('Table row for table ' . $tableName . ' is not an instance of net.stubbles.querybuilder.stubDatabaseTableRow.'); 142 142 } … … 144 144 $tableName = $tableRow->getTableName(); 145 145 $queries[$tableName] = 'UPDATE `' . $tableName . '` SET '; 146 $where = array();147 146 $counter = 0; 148 147 foreach ($tableRow->getColumns() as $columnName => $columnValue) { … … 154 153 if (null === $columnValue) { 155 154 $queries[$tableName] .= 'NULL'; 156 } elseif (is_int($columnValue) == true) {155 } elseif (is_int($columnValue) === true) { 157 156 $queries[$tableName] .= $columnValue; 158 157 } else { … … 163 162 } 164 163 165 if ($tableRow->hasCriterion() == true) {164 if ($tableRow->hasCriterion() === true) { 166 165 $queries[$tableName] .= ' WHERE ' . $tableRow->getCriterion()->toSQL(); 167 166 } … … 191 190 public function createTable(stubDatabaseTableDescription $tableDescription) 192 191 { 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) { 196 195 throw new stubDatabaseQueryBuilderException('A table must contain at least one column, but description for table ' . $tableDescription->getName() . ' does not contain any column.'); 197 196 } … … 207 206 $counter++; 208 207 $query .= ' ' . $column->getName() . ' ' . strtoupper($column->getType()); 209 if (strtoupper($column->getType()) != 'TEXT') {208 if (strtoupper($column->getType()) !== 'TEXT') { 210 209 $query .= '(' . $column->getSize() . ')'; 211 210 } 212 211 213 if ($this->isTextColumn($column->getType()) == true) {214 if ($column->hasCharacterSet() == true) {212 if ($this->isTextColumn($column->getType()) === true) { 213 if ($column->hasCharacterSet() === true) { 215 214 $query .= ' CHARACTER SET ' . $column->getCharacterSet(); 216 215 } 217 216 218 if ($column->hasCollation() == true) {217 if ($column->hasCollation() === true) { 219 218 $query .= ' COLLATE ' . $column->getCollation(); 220 219 } 221 } elseif ($this->isNumericColumn($column->getType()) == true) {220 } elseif ($this->isNumericColumn($column->getType()) === true) { 222 221 if ($column->isUnsigned() == true) { 223 222 $query .= ' UNSIGNED'; … … 229 228 } 230 229 231 if ($column->isNullable() == true && $column->getDefaultValue()== null) {230 if ($column->isNullable() === true && $column->getDefaultValue() === null) { 232 231 $query .= ' DEFAULT NULL'; 233 232 } else { … … 241 240 } 242 241 243 if ($column->isPrimaryKey() == true) {242 if ($column->isPrimaryKey() === true) { 244 243 if ($this->isNumericColumn($column->getType()) === true) { 245 244 $query .= ' AUTO_INCREMENT'; … … 247 246 248 247 $primaryKeys[] = $column->getName(); 249 } elseif ($column->isKey() == true) {248 } elseif ($column->isKey() === true) { 250 249 $keys[] = $column->getName(); 251 250 } trunk/src/main/php/net/stubbles/reflection/annotations/stubAnnotationFactory.php
r834 r984 52 52 public static function create($comment, $annotationName, $target, $targetName, $fileName) 53 53 { 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); 56 56 } 57 57 58 58 $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) { 61 61 stubClassLoader::load('net.stubbles.reflection.annotations.parser.stubAnnotationStateParser'); 62 62 self::$parser = new stubAnnotationStateParser(); … … 66 66 } 67 67 68 if (isset(self::$annotations[$hash][$annotationName]) == false) {68 if (isset(self::$annotations[$hash][$annotationName]) === false) { 69 69 throw new ReflectionException('Can not find annotation ' . $annotationName); 70 70 } … … 73 73 $annotation = new $annotationClass(); 74 74 75 if (($annotation instanceof stubAnnotation) == false) {75 if (($annotation instanceof stubAnnotation) === false) { 76 76 throw new ReflectionException('The annotation: ' . $annotationName . ' is not an instance of net.stubbles.reflection.annotations.stubAnnotation.'); 77 77 } 78 78 79 if (self::$annotations[$hash][$annotationName]['type'] != $annotationName) {79 if (self::$annotations[$hash][$annotationName]['type'] !== $annotationName) { 80 80 $annotationType = self::findAnnotationClass($annotationName, true); 81 if (is_a($annotation, $annotationType) == false) {81 if (is_a($annotation, $annotationType) === false) { 82 82 throw new ReflectionException('The annotation: ' . $annotationName . ' is not an instance of ' . $annotationType . '.'); 83 83 } 84 84 } 85 85 86 if (self::isApplicable($annotation, $target) == false) {86 if (self::isApplicable($annotation, $target) === false) { 87 87 throw new ReflectionException('The annotation: ' . $annotationName . ' is not applicable for the given type.'); 88 88 } … … 103 103 public static function isApplicable(stubAnnotation $annotation, $target) 104 104 { 105 return (($annotation->getAnnotationTarget() & $target) != 0);105 return (($annotation->getAnnotationTarget() & $target) !== 0); 106 106 } 107 107 … … 117 117 $refClass = new ReflectionClass($annotation); 118 118 foreach ($data as $name => $value) { 119 if ($refClass->hasMethod('set' . ucfirst($name)) == true) {119 if ($refClass->hasMethod('set' . ucfirst($name)) === true) { 120 120 $refClass->getMethod('set' . ucfirst($name))->invoke($annotation, $value); 121 } elseif ($refClass->hasProperty($name) == true) {121 } elseif ($refClass->hasProperty($name) === true) { 122 122 $refClass->getProperty($name)->setValue($annotation, $value); 123 123 } else { … … 141 141 public static function has($comment, $annotationName, $target, $targetName, $fileName) 142 142 { 143 $annotation = null;144 143 try { 145 144 $annotation = self::create($comment, $annotationName, $target, $targetName, $fileName); 146 145 } catch (ReflectionException $e) { 146 $annotation = null; 147 147 } 148 148 … … 172 172 private static function findAnnotationClass($annotationClass, $allowInterface = false) 173 173 { 174 if (class_exists($annotationClass, false) == true) {174 if (class_exists($annotationClass, false) === true) { 175 175 return $annotationClass; 176 176 } 177 177 178 if (true == $allowInterface && interface_exists($annotationClass, false)== true) {178 if (true === $allowInterface && interface_exists($annotationClass, false) === true) { 179 179 return $annotationClass; 180 180 } … … 182 182 $annotationClassname = $annotationClass . 'Annotation'; 183 183 foreach (self::$prefixes as $prefix) { 184 if (class_exists($prefix . $annotationClassname) == true) {184 if (class_exists($prefix . $annotationClassname) === true) { 185 185 return $prefix . $annotationClassname; 186 186 } 187 187 188 if (true == $allowInterface && interface_exists($prefix . $annotationClassname, false)== true) {188 if (true === $allowInterface && interface_exists($prefix . $annotationClassname, false) === true) { 189 189 return $prefix . $annotationClassname; 190 190 } trunk/src/main/php/net/stubbles/reflection/stubReflectionFunction.php
r942 r984 78 78 { 79 79 if ($compare instanceof self) { 80 return ($compare->functionName == $this->functionName);80 return ($compare->functionName === $this->functionName); 81 81 } 82 82 … … 143 143 $returnType = trim($returnParts[0]); 144 144 try { 145 returnstubReflectionPrimitive::forName(new ReflectionClass('stubReflectionPrimitive'), $returnType);145 $reflectionType = stubReflectionPrimitive::forName(new ReflectionClass('stubReflectionPrimitive'), $returnType); 146 146 } catch (stubIllegalArgumentException $iae) { 147 returnnew stubReflectionClass($returnType);147 $reflectionType = new stubReflectionClass($returnType); 148 148 } 149 150 return $reflectionType; 149 151 } 150 152 } trunk/src/main/php/net/stubbles/reflection/stubReflectionMethod.php
r942 r984 86 86 { 87 87 if ($compare instanceof self) { 88 return ($compare->className == $this->className && $compare->methodName== $this->methodName);88 return ($compare->className === $this->className && $compare->methodName === $this->methodName); 89 89 } 90 90 … … 163 163 $returnType = trim($returnParts[0]); 164 164 try { 165 returnstubReflectionPrimitive::forName(new ReflectionClass('stubReflectionPrimitive'), $returnType);165 $reflectionType = stubReflectionPrimitive::forName(new ReflectionClass('stubReflectionPrimitive'), $returnType); 166 166 } catch (stubIllegalArgumentException $iae) { 167 returnnew stubReflectionClass($returnType);167 $reflectionType = new stubReflectionClass($returnType); 168 168 } 169 170 return $reflectionType; 169 171 } 170 172 } trunk/src/main/php/net/stubbles/service/jsonrpc/stubJsonRpcProcessor.php
r964 r984 78 78 $this->loadServiceConfig($this->getServiceFilePath()); 79 79 80 if ($this->request->hasValue('__generateProxy') ) {80 if ($this->request->hasValue('__generateProxy') === true) { 81 81 $proxyClassvalidator = new stubRegexValidator('/^[A-Za-z,0-9_\.]+$/'); 82 82 $classes = $this->request->getValidatedValue($proxyClassvalidator, '__generateProxy', stubRequest::SOURCE_PARAM); 83 if ( $classes === '__all') {83 if ('__all' === $classes) { 84 84 $this->generateProxies(); 85 85 } else { 86 86 $this->generateProxies(explode(',', $classes)); 87 87 } 88 } elseif ($this->request->hasValue('__smd') ) {88 } elseif ($this->request->hasValue('__smd') === true) { 89 89 $smdClassvalidator = new stubRegexValidator('/^[A-Za-z0-9_\.]+$/'); 90 90 $class = $this->request->getValidatedValue($smdClassvalidator, '__smd', stubRequest::SOURCE_PARAM); … … 106 106 { 107 107 $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) { 109 109 stubClassLoader::load('net.stubbles.lang.exceptions.stubFileNotFoundException'); 110 110 throw new stubFileNotFoundException($configFile); … … 122 122 { 123 123 $cacheFile = stubConfig::getCachePath() . '/jsonrpc_' . md5($serviceConfigFile) . '.cache'; 124 if (file_exists($cacheFile) ) {124 if (file_exists($cacheFile) === true) { 125 125 $cacheData = unserialize(file_get_contents($cacheFile)); 126 126 $this->classMap = $cacheData['classMap']; 127 127 $this->serviceConfig = $cacheData['serviceConfig']; 128 return true;128 return; 129 129 } 130 130 … … 163 163 $generator = new stubJsonRpcProxyGenerator($serviceUrl); 164 164 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) { 166 166 continue; 167 167 } … … 170 170 $this->response->write($generator->generateJavascriptProxy($serviceConfig['className'], $jsClass)); 171 171 } catch (Exception $e) { 172 if ( $this->serviceConfig['use-firebug'] === true) {172 if (true === $this->serviceConfig['use-firebug']) { 173 173 $this->response->write("console.error('Generation of proxy for {$serviceConfig['className']} failed.');\n"); 174 174 $this->response->write($this->convertStringToFirebug($e->__toString())); … … 188 188 $tmp = parse_url($this->request->getURI()); 189 189 $serviceUrl = '//' . $tmp['path']; 190 if ($this->request->hasValue('processor') ) {190 if ($this->request->hasValue('processor') === true) { 191 191 $processor = $this->request->getValidatedValue(new stubPassThruValidator(), 'processor', stubRequest::SOURCE_PARAM); 192 192 $serviceUrl .= '?processor=' . $processor; … … 194 194 } 195 195 $generator = new stubSmdGenerator($serviceUrl); 196 $classInfo = $this->classMap[$class]; 196 197 try { 197 $classInfo = $this->classMap[$class];198 198 $this->response->write($generator->generateSmd($classInfo['className'], $class)); 199 199 } 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"); 202 202 $this->response->write($this->convertStringToFirebug($e->__toString())); 203 203 } … … 234 234 $requestJsonObj = $this->request->getValidatedRawData(new stubPassThruValidator()); 235 235 $phpJsonObj = json_decode($requestJsonObj); 236 if ( !is_object($phpJsonObj)) {236 if (is_object($phpJsonObj) === false) { 237 237 $this->response->writeFault(null, 'Invalid request.'); 238 238 return; 239 239 } 240 240 241 if ( !isset($phpJsonObj->id)) {241 if (isset($phpJsonObj->id) === false) { 242 242 $this->response->writeFault(null, 'Invalid request: No id given.'); 243 243 return; 244 244 } 245 245 246 if ( !isset($phpJsonObj->method)) {246 if (isset($phpJsonObj->method) === false) { 247 247 $this->response->writeFault($phpJsonObj->id, 'Invalid request: No method given.'); 248 248 return; 249 249 } 250 250 251 if ( !isset($phpJsonObj->params)) {251 if (isset($phpJsonObj->params) === false) { 252 252 $this->response->writeFault($phpJsonObj->id, 'Invalid request: No params given.'); 253 253 return; … … 256 256 try { 257 257 $className = null; 258 if ($this->request->hasValue('__class') ) {258 if ($this->request->hasValue('__class') === true) { 259 259 $className = $this->request->getValidatedValue(new stubPassThruValidator(), '__class'); 260 260 } … … 303 303 protected function getClassAndMethod($methodName, $className = null) 304 304 { 305 if ( $className === null) {305 if (null === $className) { 306 306 if (!preg_match(self::CLASS_AND_METHOD_PATTERN, $methodName)) { 307 307 throw new stubException('Invalid request: method-Pattern has to be <className>.<methodName>.'); … … 310 310 list($className, $methodName) = explode('.', $methodName); 311 311 } 312 if ( !isset($this->classMap[$className])) {312 if (isset($this->classMap[$className]) === false) { 313 313 throw new stubException('Unknown class ' . $className . '.'); 314 314 } 315 315 316 316 $clazz = new stubReflectionClass($this->classMap[$className]['className']); 317 if ($clazz->hasMethod($methodName) == false) {317 if ($clazz->hasMethod($methodName) === false) { 318 318 throw new stubException('Unknown method ' . $className . '.' . $methodName . '.'); 319 319 } 320 320 321 321 $method = $clazz->getMethod($methodName); 322 if ( !$method->hasAnnotation('WebMethod')) {322 if ($method->hasAnnotation('WebMethod') === false) { 323 323 throw new stubException('Method ' . $className . '.' . $methodName . ' is no WebMethod.'); 324 324 } trunk/src/main/php/net/stubbles/star/StarClassRegistry.php
r698 r984 63 63 } 64 64 65 if (isset(self::$classes[$fqClassName]) == true) {65 if (isset(self::$classes[$fqClassName]) === true) { 66 66 return self::$classes[$fqClassName]; 67 67 } … … 82 82 } 83 83 84 if (isset(self::$classes[$fqClassName]) == true) {84 if (isset(self::$classes[$fqClassName]) === true) { 85 85 return 'star://' . self::$classes[$fqClassName] . '?' . $fqClassName; 86 86 } … … 104 104 foreach (self::$files as $file => $contents) { 105 105 foreach ($contents as $content) { 106 if ($content == $resource) {106 if ($content === $resource) { 107 107 $uris[] = 'star://' . $file . '?' . $resource; 108 108 continue 2; … … 126 126 } 127 127 128 if (isset(self::$files[$file]) == true) {128 if (isset(self::$files[$file]) === true) { 129 129 return self::$files[$file]; 130 130 } … … 153 153 154 154 if (count(self::$libPathes) == 0) { 155 if (substr(__FILE__, 0, 7) == 'star://') {155 if (substr(__FILE__, 0, 7) === 'star://') { 156 156 $path = str_replace('star://', '', str_replace('?net.stubbles.star.StarClassRegistry', '', __FILE__)); 157 157 self::$libPathes[dirname($path)] = true; … … 162 162 163 163 foreach (self::$libPathes as $libPath => $recursive) { 164 if (file_exists($libPath . '/.cache') == true) {164 if (file_exists($libPath . '/.cache') === true) { 165 165 $cache = unserialize(file_get_contents($libPath . '/.cache')); 166 166 self::$files = array_merge(self::$files, $cache['files']); … … 179 179 $cache['classes'] = array(); 180 180 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')) { 182 182 continue; 183 183 } … … 192 192 $cache['files'][$file->getPathname()] = $classes; 193 193 194 foreach ( $archiveData['index'] as $fqClassName => $storeData) {194 foreach (array_keys($archiveData['index']) as $fqClassName) { 195 195 self::$classes[$fqClassName] = $file->getPathname(); 196 196 $cache['classes'][$fqClassName] = $file->getPathname(); … … 199 199 200 200 $cacheFile = $libPath . '/.cache'; 201 if ( !is_writable($libPath) && !is_writable($cacheFile)) {201 if (is_writable($libPath) === false && is_writable($cacheFile) === false) { 202 202 throw new StarException("Unable to write starRegistry cache file to {$cacheFile}."); 203 203 } 204 204 205 file_put_contents($cacheFile, serialize($cache)); 205 206 self::$initDone = true; trunk/src/main/php/net/stubbles/util/net/http/stubHTTPResponse.php
r719 r984 117 117 $header = ''; 118 118 $line = ''; 119 while ($this->socket->eof() == false && stubHTTPConnection::END_OF_LINE != $line) {119 while ($this->socket->eof() === false && stubHTTPConnection::END_OF_LINE !== $line) { 120 120 $line = $this->socket->read(); 121 121 $header .= $line; … … 123 123 124 124 $this->headers = stubHeaderList::fromString($header); 125 if ($this->headers->containsKey('Content-Length') == true) {125 if ($this->headers->containsKey('Content-Length') === true) { 126 126 $readLength = $this->headers->get('Content-Length'); 127 127 } else { … … 131 131 if (self::STATUS_CLASS_SUCCESS == $this->getType(self::TYPE_STATUS_CLASS)) { 132 132 // if server sends chunked data 133 if ($this->headers->containsKey('Transfer-Encoding') == true && $this->headers->get('Transfer-Encoding')== 'chunked') {133 &n
