Passed
Pull Request — master (#40)
by Alex
03:15
created
src/Interfaces/Values/IBinaryValue.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,5 +17,5 @@
 block discarded – undo
17 17
     /**
18 18
      * @return string[] gets the definition of this binary value
19 19
      */
20
-    public function getValue(): array ;
20
+    public function getValue(): array;
21 21
 }
Please login to merge, or discard this patch.
src/Util/UnmanagedByteArray.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
     public function getIterator()
29 29
     {
30 30
         rewind($this->memoryStream);
31
-        while(false !== $char = fgetc($this->memoryStream)){
31
+        while (false !== $char = fgetc($this->memoryStream)) {
32 32
             yield ord($char);
33 33
         }
34 34
     }
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
      */
39 39
     public function offsetExists($offset)
40 40
     {
41
-        return is_int($offset) && 0 <= $offset  && $offset < $this->length;
41
+        return is_int($offset) && 0 <= $offset && $offset < $this->length;
42 42
     }
43 43
 
44 44
     /**
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
      */
47 47
     public function offsetGet($offset)
48 48
     {
49
-        if(!$this->offsetExists($offset)){
49
+        if (!$this->offsetExists($offset)) {
50 50
             throw new ArgumentException(sprintf('%s is out of range', $offset));
51 51
         }
52 52
         fseek($this->memoryStream, $offset);
@@ -58,18 +58,18 @@  discard block
 block discarded – undo
58 58
      */
59 59
     public function offsetSet($offset, $value)
60 60
     {
61
-        if(!is_int($value) || $value <0 || $value > 255){
61
+        if (!is_int($value) || $value < 0 || $value > 255) {
62 62
             throw new \InvalidArgumentException(sprintf('%s is an invalid value for a ByteArray', $value));
63 63
         }
64
-        if($this->readonly){
64
+        if ($this->readonly) {
65 65
             throw new InvalidOperationException('attempt to write to read only array');
66 66
         }
67
-        if($offset !== null || $offset < 0 || $offset > $this->length ){
67
+        if ($offset !== null || $offset < 0 || $offset > $this->length) {
68 68
             throw new \InvalidArgumentException('allowable offsets are between 0 and full legnth or null');
69 69
         }
70
-        if(null === $offset){
70
+        if (null === $offset) {
71 71
             fseek($this->memoryStream, 0, SEEK_END);
72
-        }else {
72
+        } else {
73 73
             fseek($this->memoryStream, $offset);
74 74
         }
75 75
         fwrite($this->memoryStream, chr($value));
Please login to merge, or discard this patch.
Braces   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
     public function getIterator()
29 29
     {
30 30
         rewind($this->memoryStream);
31
-        while(false !== $char = fgetc($this->memoryStream)){
31
+        while(false !== $char = fgetc($this->memoryStream)) {
32 32
             yield ord($char);
33 33
         }
34 34
     }
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
      */
47 47
     public function offsetGet($offset)
48 48
     {
49
-        if(!$this->offsetExists($offset)){
49
+        if(!$this->offsetExists($offset)) {
50 50
             throw new ArgumentException(sprintf('%s is out of range', $offset));
51 51
         }
52 52
         fseek($this->memoryStream, $offset);
@@ -58,18 +58,18 @@  discard block
 block discarded – undo
58 58
      */
59 59
     public function offsetSet($offset, $value)
60 60
     {
61
-        if(!is_int($value) || $value <0 || $value > 255){
61
+        if(!is_int($value) || $value <0 || $value > 255) {
62 62
             throw new \InvalidArgumentException(sprintf('%s is an invalid value for a ByteArray', $value));
63 63
         }
64
-        if($this->readonly){
64
+        if($this->readonly) {
65 65
             throw new InvalidOperationException('attempt to write to read only array');
66 66
         }
67
-        if($offset !== null || $offset < 0 || $offset > $this->length ){
67
+        if($offset !== null || $offset < 0 || $offset > $this->length ) {
68 68
             throw new \InvalidArgumentException('allowable offsets are between 0 and full legnth or null');
69 69
         }
70
-        if(null === $offset){
70
+        if(null === $offset) {
71 71
             fseek($this->memoryStream, 0, SEEK_END);
72
-        }else {
72
+        } else {
73 73
             fseek($this->memoryStream, $offset);
74 74
         }
75 75
         fwrite($this->memoryStream, chr($value));
Please login to merge, or discard this patch.
src/Util/ExpressionTypeChecker.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
                 // If we don't have the applied function we just assume that it will work.
198 198
                 $discoveredErrors = [];
199 199
                 return true;
200
-            case ExpressionKind::If():
200
+            case ExpressionKind::If ():
201 201
                 assert($expression instanceof IIfExpression);
202 202
                 return self::TryAssertIfAsType($expression, $type, $context, $matchExactly, $discoveredErrors);
203 203
             case ExpressionKind::IsType():
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
         iterable &$discoveredErrors
296 296
     ): bool {
297 297
         if (!$type->IsPrimitive()) {
298
-            $discoveredErrors =  [
298
+            $discoveredErrors = [
299 299
                 new EdmError(
300 300
                     $expression->Location(),
301 301
                     EdmErrorCode::PrimitiveConstantExpressionNotValidForNonPrimitiveType(),
@@ -467,8 +467,8 @@  discard block
 block discarded – undo
467 467
         assert($definition instanceof IStructuredType);
468 468
         foreach ($definition->Properties() as $typeProperty) {
469 469
             $expressionProperty = null;
470
-            foreach($expression->getProperties() as $p) {
471
-                if($p->getName() === $typeProperty->getName()) {
470
+            foreach ($expression->getProperties() as $p) {
471
+                if ($p->getName() === $typeProperty->getName()) {
472 472
                     $expressionProperty = $p;
473 473
                     break;
474 474
                 }
@@ -787,7 +787,7 @@  discard block
 block discarded – undo
787 787
                     $discoveredErrors
788 788
                 );
789 789
             default:
790
-                $discoveredErrors =  [
790
+                $discoveredErrors = [
791 791
                     new EdmError(
792 792
                         $expression->Location(),
793 793
                         EdmErrorCode::ExpressionPrimitiveKindNotValidForAssertedType(),
@@ -907,7 +907,7 @@  discard block
 block discarded – undo
907 907
 
908 908
             if ($expressionType->getTypeKind()->isPrimitive() && $assertedType->getTypeKind()->isPrimitive()) {
909 909
                 $primitiveExpressionType = $expressionType;
910
-                $primitiveAssertedType = $assertedType ;
910
+                $primitiveAssertedType = $assertedType;
911 911
                 assert($primitiveExpressionType instanceof IPrimitiveType);
912 912
                 assert($primitiveAssertedType instanceof IPrimitiveType);
913 913
                 if (!self::PromotesTo(
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
                     );
173 173
                 }
174 174
                 return self::TryAssertPrimitiveAsType($primitiveValue, $type, $discoveredErrors);
175
-            case ExpressionKind::Null():
175
+            case ExpressionKind::null():
176 176
                 assert($expression instanceof INullExpression);
177 177
                 return self::TryAssertNullAsType($expression, $type, $discoveredErrors);
178 178
             case ExpressionKind::Path():
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
                 // If we don't have the applied function we just assume that it will work.
198 198
                 $discoveredErrors = [];
199 199
                 return true;
200
-            case ExpressionKind::If():
200
+            case ExpressionKind::if():
201 201
                 assert($expression instanceof IIfExpression);
202 202
                 return self::TryAssertIfAsType($expression, $type, $context, $matchExactly, $discoveredErrors);
203 203
             case ExpressionKind::IsType():
Please login to merge, or discard this patch.
src/Util/XmlConvert.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -55,9 +55,9 @@
 block discarded – undo
55 55
 
56 56
     public static function VerifyNCName(string $name): bool{
57 57
         $length = strlen($name);
58
-        for( $i = 1; $i < $length; $i++)
58
+        for ($i = 1; $i < $length; $i++)
59 59
         {
60
-            if(!self::IsNCNameChar($name[$i])){
60
+            if (!self::IsNCNameChar($name[$i])) {
61 61
                 return false;
62 62
             }
63 63
         }
Please login to merge, or discard this patch.
Braces   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -55,9 +55,8 @@
 block discarded – undo
55 55
 
56 56
     public static function VerifyNCName(string $name): bool{
57 57
         $length = strlen($name);
58
-        for( $i = 1; $i < $length; $i++)
59
-        {
60
-            if(!self::IsNCNameChar($name[$i])){
58
+        for( $i = 1; $i < $length; $i++) {
59
+            if(!self::IsNCNameChar($name[$i])) {
61 60
                 return false;
62 61
             }
63 62
         }
Please login to merge, or discard this patch.
src/Util/XmlCharType.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -334,7 +334,7 @@
 block discarded – undo
334 334
             $str1 = mb_substr($ranges,$p,1,'UTF-8');
335 335
             $str2 = mb_substr($ranges,$p+1,1,'UTF-8');
336 336
             for ($i = mb_ord($str1),
337
-                 $last = mb_ord($str2); $i <= $last; $i++)
337
+                    $last = mb_ord($str2); $i <= $last; $i++)
338 338
             {
339 339
                 if(!isset(self::$s_CharProperties[$i])){
340 340
                     self::$s_CharProperties[$i] = $value;
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -305,10 +305,10 @@  discard block
 block discarded – undo
305 305
         if (self::$m_CharProperties != null) {
306 306
             return;
307 307
         }
308
-        if(file_exists('XmlCharType.bin')){
308
+        if (file_exists('XmlCharType.bin')) {
309 309
             $file = fopen('XmlCharType.bin', 'rb');
310 310
             self::$m_CharProperties = fopen('php://memory', 'w+b');
311
-            stream_copy_to_stream($file,self::$m_CharProperties);
311
+            stream_copy_to_stream($file, self::$m_CharProperties);
312 312
             fclose($file);
313 313
             return;
314 314
         }
@@ -329,28 +329,28 @@  discard block
 block discarded – undo
329 329
     private static function SetProperties(string $ranges, int $value): void
330 330
     {
331 331
         assert(mb_strlen($ranges, 'UTF-8') % 2 === 0);
332
-        for ($p = 0; $p < mb_strlen($ranges, 'UTF-8'); $p +=2)
332
+        for ($p = 0; $p < mb_strlen($ranges, 'UTF-8'); $p += 2)
333 333
         {
334
-            $str1 = mb_substr($ranges,$p,1,'UTF-8');
335
-            $str2 = mb_substr($ranges,$p+1,1,'UTF-8');
334
+            $str1 = mb_substr($ranges, $p, 1, 'UTF-8');
335
+            $str2 = mb_substr($ranges, $p + 1, 1, 'UTF-8');
336 336
             for ($i = mb_ord($str1),
337 337
                  $last = mb_ord($str2); $i <= $last; $i++)
338 338
             {
339
-                if(!isset(self::$s_CharProperties[$i])){
339
+                if (!isset(self::$s_CharProperties[$i])) {
340 340
                     self::$s_CharProperties[$i] = $value;
341 341
                 }
342 342
                 self::$s_CharProperties[$i] |= $value;
343 343
             }
344 344
         }
345 345
     }
346
-    protected static function generateFile(){
346
+    protected static function generateFile() {
347 347
         $fileArray = [];
348
-        for($i = 0; $i < 65536; $i++){
348
+        for ($i = 0; $i < 65536; $i++) {
349 349
             $fileArray[$i] = XmlCharType::$s_CharProperties[$i] ?? 0;
350 350
         }
351 351
         $bin = fopen(__DIR__ . DIRECTORY_SEPARATOR . 'XmlCharType.bin', 'w+b');
352 352
         self::$m_CharProperties = fopen('php://memory', 'w+b');
353
-        foreach($fileArray as $enum){
353
+        foreach ($fileArray as $enum) {
354 354
             fwrite($bin, chr($enum));
355 355
             fwrite(self::$m_CharProperties, chr($enum));
356 356
         }
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
     #endregion
360 360
 
361 361
     private static $instance = null;
362
-    public static function Instance(){
362
+    public static function Instance() {
363 363
         self::InitInstance();
364 364
         $umArray = new UnmanagedByteArray(self::$m_CharProperties);
365 365
         return self::$instance ?? self::$instance = new self($umArray);
Please login to merge, or discard this patch.
Braces   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
         if (self::$m_CharProperties != null) {
306 306
             return;
307 307
         }
308
-        if(file_exists('XmlCharType.bin')){
308
+        if(file_exists('XmlCharType.bin')) {
309 309
             $file = fopen('XmlCharType.bin', 'rb');
310 310
             self::$m_CharProperties = fopen('php://memory', 'w+b');
311 311
             stream_copy_to_stream($file,self::$m_CharProperties);
@@ -329,28 +329,27 @@  discard block
 block discarded – undo
329 329
     private static function SetProperties(string $ranges, int $value): void
330 330
     {
331 331
         assert(mb_strlen($ranges, 'UTF-8') % 2 === 0);
332
-        for ($p = 0; $p < mb_strlen($ranges, 'UTF-8'); $p +=2)
333
-        {
332
+        for ($p = 0; $p < mb_strlen($ranges, 'UTF-8'); $p +=2) {
334 333
             $str1 = mb_substr($ranges,$p,1,'UTF-8');
335 334
             $str2 = mb_substr($ranges,$p+1,1,'UTF-8');
336 335
             for ($i = mb_ord($str1),
337
-                 $last = mb_ord($str2); $i <= $last; $i++)
338
-            {
339
-                if(!isset(self::$s_CharProperties[$i])){
336
+                 $last = mb_ord($str2); $i <= $last; $i++) {
337
+                if(!isset(self::$s_CharProperties[$i])) {
340 338
                     self::$s_CharProperties[$i] = $value;
341 339
                 }
342 340
                 self::$s_CharProperties[$i] |= $value;
343 341
             }
344 342
         }
345 343
     }
346
-    protected static function generateFile(){
344
+    protected static function generateFile()
345
+    {
347 346
         $fileArray = [];
348
-        for($i = 0; $i < 65536; $i++){
347
+        for($i = 0; $i < 65536; $i++) {
349 348
             $fileArray[$i] = XmlCharType::$s_CharProperties[$i] ?? 0;
350 349
         }
351 350
         $bin = fopen(__DIR__ . DIRECTORY_SEPARATOR . 'XmlCharType.bin', 'w+b');
352 351
         self::$m_CharProperties = fopen('php://memory', 'w+b');
353
-        foreach($fileArray as $enum){
352
+        foreach($fileArray as $enum) {
354 353
             fwrite($bin, chr($enum));
355 354
             fwrite(self::$m_CharProperties, chr($enum));
356 355
         }
@@ -359,7 +358,8 @@  discard block
 block discarded – undo
359 358
     #endregion
360 359
 
361 360
     private static $instance = null;
362
-    public static function Instance(){
361
+    public static function Instance()
362
+    {
363 363
         self::InitInstance();
364 364
         $umArray = new UnmanagedByteArray(self::$m_CharProperties);
365 365
         return self::$instance ?? self::$instance = new self($umArray);
Please login to merge, or discard this patch.
src/Edm/Validation/EdmValidator.php 1 patch
Spacing   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,8 +27,7 @@
 block discarded – undo
27 27
     public static function Validate(IModel $root, $versionOrRuleset, array &$errors): bool
28 28
     {
29 29
         $ruleSet = $versionOrRuleset instanceof Version ?
30
-            ValidationRuleSet::getEdmModelRuleSet($versionOrRuleset) :
31
-            $versionOrRuleset;
30
+            ValidationRuleSet::getEdmModelRuleSet($versionOrRuleset) : $versionOrRuleset;
32 31
         assert($ruleSet instanceof ValidationRuleSet);
33 32
         $errors = InterfaceValidator::ValidateModelStructureAndSemantics($root, $ruleSet);
34 33
         return count($errors) === 0;
Please login to merge, or discard this patch.
src/Edm/Validation/ValidationRuleSet.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
      */
160 160
     public static function getEdmModelRuleSet(Version $version): self
161 161
     {
162
-        switch ($version){
162
+        switch ($version) {
163 163
             case Version::v1():
164 164
                 return self::getV1RuleSet();
165 165
             case Version::v1_1():
@@ -187,10 +187,10 @@  discard block
 block discarded – undo
187 187
     private function AddRule(ValidationRule $rule):void
188 188
     {
189 189
         $typeName = $rule->getValidatedType();
190
-        if(!isset($this->rules[$typeName])){
190
+        if (!isset($this->rules[$typeName])) {
191 191
             $this->rules[$typeName] = [];
192 192
         }
193
-        if(in_array($rule, $this->rules[$typeName])){
193
+        if (in_array($rule, $this->rules[$typeName])) {
194 194
             throw new InvalidOperationException(StringConst::RuleSet_DuplicateRulesExistInRuleSet());
195 195
         }
196 196
         $this->rules[$typeName][] = $rule;
@@ -322,11 +322,11 @@  discard block
 block discarded – undo
322 322
 
323 323
     private static function getV1_1RuleSet(): self{
324 324
         $filteredBase = [];
325
-        foreach(self::getBaseRuleSet() as $baseRule){
326
-            if(
325
+        foreach (self::getBaseRuleSet() as $baseRule) {
326
+            if (
327 327
                 $baseRule instanceof ComplexTypeInvalidAbstractComplexType ||
328 328
                 $baseRule instanceof ComplexTypeInvalidPolymorphicComplexType
329
-            ){
329
+            ) {
330 330
                 continue;
331 331
             }
332 332
             $filteredBase[] = $baseRule;
@@ -357,11 +357,11 @@  discard block
 block discarded – undo
357 357
     private static function getV1_2RuleSet(): self
358 358
     {
359 359
         $filteredBase = [];
360
-        foreach(self::getBaseRuleSet() as $baseRule){
361
-            if(
360
+        foreach (self::getBaseRuleSet() as $baseRule) {
361
+            if (
362 362
                 $baseRule instanceof ComplexTypeInvalidAbstractComplexType ||
363 363
                 $baseRule instanceof ComplexTypeInvalidPolymorphicComplexType
364
-            ){
364
+            ) {
365 365
                 continue;
366 366
             }
367 367
             $filteredBase[] = $baseRule;
Please login to merge, or discard this patch.
Braces   +9 added lines, -11 removed lines patch added patch discarded remove patch
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
      */
160 160
     public static function getEdmModelRuleSet(Version $version): self
161 161
     {
162
-        switch ($version){
162
+        switch ($version) {
163 163
             case Version::v1():
164 164
                 return self::getV1RuleSet();
165 165
             case Version::v1_1():
@@ -187,10 +187,10 @@  discard block
 block discarded – undo
187 187
     private function AddRule(ValidationRule $rule):void
188 188
     {
189 189
         $typeName = $rule->getValidatedType();
190
-        if(!isset($this->rules[$typeName])){
190
+        if(!isset($this->rules[$typeName])) {
191 191
             $this->rules[$typeName] = [];
192 192
         }
193
-        if(in_array($rule, $this->rules[$typeName])){
193
+        if(in_array($rule, $this->rules[$typeName])) {
194 194
             throw new InvalidOperationException(StringConst::RuleSet_DuplicateRulesExistInRuleSet());
195 195
         }
196 196
         $this->rules[$typeName][] = $rule;
@@ -322,11 +322,11 @@  discard block
 block discarded – undo
322 322
 
323 323
     private static function getV1_1RuleSet(): self{
324 324
         $filteredBase = [];
325
-        foreach(self::getBaseRuleSet() as $baseRule){
325
+        foreach(self::getBaseRuleSet() as $baseRule) {
326 326
             if(
327 327
                 $baseRule instanceof ComplexTypeInvalidAbstractComplexType ||
328 328
                 $baseRule instanceof ComplexTypeInvalidPolymorphicComplexType
329
-            ){
329
+            ) {
330 330
                 continue;
331 331
             }
332 332
             $filteredBase[] = $baseRule;
@@ -357,11 +357,11 @@  discard block
 block discarded – undo
357 357
     private static function getV1_2RuleSet(): self
358 358
     {
359 359
         $filteredBase = [];
360
-        foreach(self::getBaseRuleSet() as $baseRule){
360
+        foreach(self::getBaseRuleSet() as $baseRule) {
361 361
             if(
362 362
                 $baseRule instanceof ComplexTypeInvalidAbstractComplexType ||
363 363
                 $baseRule instanceof ComplexTypeInvalidPolymorphicComplexType
364
-            ){
364
+            ) {
365 365
                 continue;
366 366
             }
367 367
             $filteredBase[] = $baseRule;
@@ -425,10 +425,8 @@  discard block
 block discarded – undo
425 425
      */
426 426
     public function getIterator(): Traversable
427 427
     {
428
-        foreach ($this->rules as $ruleList)
429
-        {
430
-            foreach ($ruleList as $rule)
431
-            {
428
+        foreach ($this->rules as $ruleList) {
429
+            foreach ($ruleList as $rule) {
432 430
                 assert($rule instanceof ValidationRule);
433 431
                 yield $rule;
434 432
             }
Please login to merge, or discard this patch.
src/Edm/Validation/ValidationContext.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@
 block discarded – undo
42 42
     {
43 43
 
44 44
         assert(
45
-            Asserts::assertSignatureMatches(function(IEdmElement $one): bool{}, $isBad, '$isBad')
45
+            Asserts::assertSignatureMatches(function (IEdmElement $one): bool{}, $isBad, '$isBad')
46 46
         );
47 47
         /* @noinspection PhpUnhandledExceptionInspection suppressing exceptions for asserts.*/
48 48
         assert(
Please login to merge, or discard this patch.
IVocabularyAnnotation/VocabularyAnnotationInaccessibleTarget.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -34,14 +34,14 @@  discard block
 block discarded – undo
34 34
         $target = $annotation->getTarget();
35 35
         $foundTarget = false;
36 36
 
37
-        $entityContainer = $target ;
38
-        if ( $entityContainer instanceof IEntityContainer)
37
+        $entityContainer = $target;
38
+        if ($entityContainer instanceof IEntityContainer)
39 39
         {
40 40
             $foundTarget = ($context->getModel()->findEntityContainer($entityContainer->FullName()) != null);
41 41
         }
42 42
         else
43 43
         {
44
-            $entitySet = $target ;
44
+            $entitySet = $target;
45 45
             if ($entitySet instanceof IEntitySet)
46 46
             {
47 47
                 $container = $entitySet->getContainer();
@@ -59,10 +59,10 @@  discard block
 block discarded – undo
59 59
                 }
60 60
                 else
61 61
                 {
62
-                    $term = $target ;
62
+                    $term = $target;
63 63
                     if ($term != null && $term instanceof ITerm)
64 64
                     {
65
-                        $foundTarget = ($context->getModel()->FindValueTerm($term->FullName())!= null);
65
+                        $foundTarget = ($context->getModel()->FindValueTerm($term->FullName()) != null);
66 66
                     }
67 67
                     else
68 68
                     {
Please login to merge, or discard this patch.
Braces   +26 added lines, -61 removed lines patch added patch discarded remove patch
@@ -35,102 +35,68 @@  discard block
 block discarded – undo
35 35
         $foundTarget = false;
36 36
 
37 37
         $entityContainer = $target ;
38
-        if ( $entityContainer instanceof IEntityContainer)
39
-        {
38
+        if ( $entityContainer instanceof IEntityContainer) {
40 39
             $foundTarget = ($context->getModel()->findEntityContainer($entityContainer->FullName()) != null);
41
-        }
42
-        else
43
-        {
40
+        } else {
44 41
             $entitySet = $target ;
45
-            if ($entitySet instanceof IEntitySet)
46
-            {
42
+            if ($entitySet instanceof IEntitySet) {
47 43
                 $container = $entitySet->getContainer();
48
-                if ($container != null && $context instanceof IEntityContainer)
49
-                {
44
+                if ($container != null && $context instanceof IEntityContainer) {
50 45
                     $foundTarget = ($container->findEntitySet($entitySet->getName()) != null);
51 46
                 }
52
-            }
53
-            else
54
-            {
47
+            } else {
55 48
                 $schemaType = $target;
56
-                if ($schemaType != null && $schemaType instanceof ISchemaType)
57
-                {
49
+                if ($schemaType != null && $schemaType instanceof ISchemaType) {
58 50
                     $foundTarget = ($context->getModel()->FindType($schemaType->FullName()) != null);
59
-                }
60
-                else
61
-                {
51
+                } else {
62 52
                     $term = $target ;
63
-                    if ($term != null && $term instanceof ITerm)
64
-                    {
53
+                    if ($term != null && $term instanceof ITerm) {
65 54
                         $foundTarget = ($context->getModel()->FindValueTerm($term->FullName())!= null);
66
-                    }
67
-                    else
68
-                    {
55
+                    } else {
69 56
                         $function = $target;
70
-                        if ($function != null && $function instanceof IFunction)
71
-                        {
57
+                        if ($function != null && $function instanceof IFunction) {
72 58
                             $foundTarget = count($context->getModel()->FindFunctions($function->FullName())) > 0;
73
-                        }
74
-                        else
75
-                        {
59
+                        } else {
76 60
                             $functionImport = $target;
77
-                            if ($functionImport != null && $functionImport instanceof IFunctionImport)
78
-                            {
61
+                            if ($functionImport != null && $functionImport instanceof IFunctionImport) {
79 62
                                 $foundTarget = count($functionImport->getContainer()->findFunctionImports($functionImport->getName())) > 0;
80
-                            }
81
-                            else
82
-                            {
63
+                            } else {
83 64
                                 $typeProperty = $target;
84
-                                if ($typeProperty != null && $typeProperty instanceof IProperty)
85
-                                {
65
+                                if ($typeProperty != null && $typeProperty instanceof IProperty) {
86 66
                                     $declaringType = $typeProperty->getDeclaringType();
87 67
                                     assert($declaringType instanceof ISchemaType);
88 68
                                     $declaringTypeFullName = EdmUtil::FullyQualifiedName($declaringType);
89 69
                                     $modelType = $context->getModel()->FindType($declaringTypeFullName);
90
-                                    if ($modelType != null && $modelType instanceof IStructuredType)
91
-                                    {
70
+                                    if ($modelType != null && $modelType instanceof IStructuredType) {
92 71
                                         // If we can find a structured type with this name in the model check if it has a property with this name
93 72
                                         $foundTarget = ($modelType->findProperty($typeProperty->getName()) != null);
94 73
                                     }
95
-                                }
96
-                                else
97
-                                {
74
+                                } else {
98 75
                                     $functionParameter = $target;
99
-                                    if ($functionParameter != null && $functionParameter instanceof IFunctionParameter)
100
-                                    {
76
+                                    if ($functionParameter != null && $functionParameter instanceof IFunctionParameter) {
101 77
                                         $declaringFunction = $functionParameter->getDeclaringFunction();
102
-                                        if ($declaringFunction != null && $declaringFunction instanceof  IFunction)
103
-                                        {
78
+                                        if ($declaringFunction != null && $declaringFunction instanceof  IFunction) {
104 79
                                             // For all functions with this name declared in the model check if it has a parameter with this name
105
-                                            foreach ($context->getModel()->FindFunctions($declaringFunction->FullName()) as $func)
106
-                                            {
107
-                                                if ($func->findParameter($functionParameter->getName()) != null)
108
-                                                {
80
+                                            foreach ($context->getModel()->FindFunctions($declaringFunction->FullName()) as $func) {
81
+                                                if ($func->findParameter($functionParameter->getName()) != null) {
109 82
                                                     $foundTarget = true;
110 83
                                                     break;
111 84
                                                 }
112 85
                                             }
113
-                                        }
114
-                                        else
115
-                                        {
86
+                                        } else {
116 87
                                             $declaringFunctionImport = $functionParameter->getDeclaringFunction();
117
-                                            if ($declaringFunctionImport != null && $declaringFunctionImport instanceof IFunctionImport)
118
-                                            {
88
+                                            if ($declaringFunctionImport != null && $declaringFunctionImport instanceof IFunctionImport) {
119 89
                                                 $container = $declaringFunctionImport->getContainer();
120 90
                                                 assert($container instanceof IEntityContainer);
121
-                                                foreach ($container->findFunctionImports($declaringFunctionImport->getName()) as $currentFunction)
122
-                                                {
123
-                                                    if ($currentFunction->findParameter($functionParameter->getName()) != null)
124
-                                                    {
91
+                                                foreach ($container->findFunctionImports($declaringFunctionImport->getName()) as $currentFunction) {
92
+                                                    if ($currentFunction->findParameter($functionParameter->getName()) != null) {
125 93
                                                         $foundTarget = true;
126 94
                                                         break;
127 95
                                                     }
128 96
                                                 }
129 97
                                             }
130 98
                                         }
131
-                                    }
132
-                                    else
133
-                                    {
99
+                                    } else {
134 100
                                         // Only validate annotations targeting elements that can be found via the model API.
135 101
                                         // E.g. annotations targeting annotations will not be valid without this branch.
136 102
                                         $foundTarget = true;
@@ -143,8 +109,7 @@  discard block
 block discarded – undo
143 109
             }
144 110
         }
145 111
 
146
-        if (!$foundTarget)
147
-        {
112
+        if (!$foundTarget) {
148 113
             $context->AddError(
149 114
                 $annotation->Location(),
150 115
                 EdmErrorCode::BadUnresolvedTarget(),
Please login to merge, or discard this patch.