Completed
Push — master ( 4cd686...a44c06 )
by Andreas
05:44
created
src/api/object.php 1 patch
Braces   +18 added lines, -36 removed lines patch added patch discarded remove patch
@@ -33,8 +33,7 @@  discard block
 block discarded – undo
33 33
             if (is_int($id))
34 34
             {
35 35
                 $this->get_by_id($id);
36
-            }
37
-            else if (is_string($id))
36
+            } else if (is_string($id))
38 37
             {
39 38
                 $this->get_by_guid($id);
40 39
             }
@@ -98,8 +97,7 @@  discard block
 block discarded – undo
98 97
                     try
99 98
                     {
100 99
                         $this->$candidate->get_by_id($this->$candidate->id);
101
-                    }
102
-                    catch (exception $e)
100
+                    } catch (exception $e)
103 101
                     {
104 102
                         connection::log()->error('Failed to refresh parent from proxy: ' . $e->getMessage());
105 103
                         return null;
@@ -127,8 +125,7 @@  discard block
 block discarded – undo
127 125
             try
128 126
             {
129 127
                 $entity->__load();
130
-            }
131
-            catch (\Doctrine\ORM\EntityNotFoundException $e)
128
+            } catch (\Doctrine\ORM\EntityNotFoundException $e)
132 129
             {
133 130
                 throw exception::object_purged();
134 131
             }
@@ -189,8 +186,7 @@  discard block
 block discarded – undo
189 186
         {
190 187
             $om = new objectmanager(connection::get_em());
191 188
             $om->create($this);
192
-        }
193
-        catch (\Exception $e)
189
+        } catch (\Exception $e)
194 190
         {
195 191
             exception::internal($e);
196 192
             return false;
@@ -216,8 +212,7 @@  discard block
 block discarded – undo
216 212
         {
217 213
             $om = new objectmanager(connection::get_em());
218 214
             $om->update($this);
219
-        }
220
-        catch (\Exception $e)
215
+        } catch (\Exception $e)
221 216
         {
222 217
             exception::internal($e);
223 218
             return false;
@@ -257,8 +252,7 @@  discard block
 block discarded – undo
257 252
         {
258 253
             $om = new objectmanager(connection::get_em());
259 254
             $om->delete($this);
260
-        }
261
-        catch (\Exception $e)
255
+        } catch (\Exception $e)
262 256
         {
263 257
             exception::internal($e);
264 258
             return false;
@@ -312,8 +306,7 @@  discard block
 block discarded – undo
312 306
             if ($this->{$this->cm->midgard['upfield']} === null)
313 307
             {
314 308
                 $conditions->add($qb->expr()->isNull('c.' . $this->cm->midgard['upfield']));
315
-            }
316
-            else
309
+            } else
317 310
             {
318 311
                 $conditions->add($qb->expr()->eq('c.' . $this->cm->midgard['upfield'], ':' . $this->cm->midgard['upfield']));
319 312
                 $parameters[$this->cm->midgard['upfield']] = $this->{$this->cm->midgard['upfield']};
@@ -480,14 +473,12 @@  discard block
 block discarded – undo
480 473
             $parentclass = $this->cm->fullyQualifiedClassName($this->cm->midgard['parent']);
481 474
             $parentfield = $parent_cm->midgard['upfield'];
482 475
             $upfield = $this->cm->midgard['parentfield'];
483
-        }
484
-        else if (!empty($this->cm->midgard['upfield']))
476
+        } else if (!empty($this->cm->midgard['upfield']))
485 477
         {
486 478
             $parentclass = get_class($this);
487 479
             $upfield = $this->cm->midgard['upfield'];
488 480
             $parentfield = $upfield;
489
-        }
490
-        else
481
+        } else
491 482
         {
492 483
             return false;
493 484
         }
@@ -546,8 +537,7 @@  discard block
 block discarded – undo
546 537
                 ->add($qb->expr()->isNull('c.' . $upfield))
547 538
                 ->add($qb->expr()->eq('c.' . $upfield, '0'));
548 539
             $conditions->add($empty_conditions);
549
-        }
550
-        else
540
+        } else
551 541
         {
552 542
             $conditions->add($qb->expr()->eq('c.' . $upfield, ':' . $upfield));
553 543
             $parameters[$upfield] = $up;
@@ -612,8 +602,7 @@  discard block
 block discarded – undo
612 602
         try
613 603
         {
614 604
             return $qb->getQuery()->getOneOrNullResult(Query::HYDRATE_SINGLE_SCALAR);
615
-        }
616
-        catch (\Doctrine\ORM\NoResultException $e)
605
+        } catch (\Doctrine\ORM\NoResultException $e)
617 606
         {
618 607
             return null;
619 608
         }
@@ -665,8 +654,7 @@  discard block
 block discarded – undo
665 654
             }
666 655
             midgard_connection::get_instance()->set_error(MGD_ERR_OK);
667 656
             return true;
668
-        }
669
-        catch (\Exception $e)
657
+        } catch (\Exception $e)
670 658
         {
671 659
             exception::internal($e);
672 660
             return false;
@@ -737,8 +725,7 @@  discard block
 block discarded – undo
737 725
             $om->create($att);
738 726
             midgard_connection::get_instance()->set_error(MGD_ERR_OK);
739 727
             return $att;
740
-        }
741
-        catch (\Exception $e)
728
+        } catch (\Exception $e)
742 729
         {
743 730
             exception::internal($e);
744 731
             return null;
@@ -773,13 +760,11 @@  discard block
 block discarded – undo
773 760
         {
774 761
             $om = new objectmanager(connection::get_em());
775 762
             $om->purge($this);
776
-        }
777
-        catch (\Doctrine\ORM\EntityNotFoundException $e)
763
+        } catch (\Doctrine\ORM\EntityNotFoundException $e)
778 764
         {
779 765
             exception::not_exists();
780 766
             return false;
781
-        }
782
-        catch (\Exception $e)
767
+        } catch (\Exception $e)
783 768
         {
784 769
             exception::internal($e);
785 770
             return false;
@@ -842,12 +827,10 @@  discard block
 block discarded – undo
842 827
         if ($action == 'lock')
843 828
         {
844 829
             $flag = 'islocked';
845
-        }
846
-        else if ($action == 'approve')
830
+        } else if ($action == 'approve')
847 831
         {
848 832
             $flag = 'isapproved';
849
-        }
850
-        else
833
+        } else
851 834
         {
852 835
             throw new exception('Unsupported action ' . $action);
853 836
         }
@@ -867,8 +850,7 @@  discard block
 block discarded – undo
867 850
             {
868 851
                 $om = new objectmanager(connection::get_em());
869 852
                 $om->{$action}($this);
870
-            }
871
-            catch (\Exception $e)
853
+            } catch (\Exception $e)
872 854
             {
873 855
                 exception::internal($e);
874 856
                 return false;
Please login to merge, or discard this patch.
src/api/error/exception.php 1 patch
Spacing   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -41,8 +41,7 @@
 block discarded – undo
41 41
     const TREE_IS_CIRCULAR = -26;
42 42
     const OBJECT_IS_LOCKED = -27;
43 43
 
44
-    private static $messages = array
45
-    (
44
+    private static $messages = array(
46 45
         self::OK => "MGD_ERR_OK",
47 46
         self::ACCESS_DENIED => "Access Denied.",
48 47
         self::NO_METADATA => "Metadata class not defined.",
Please login to merge, or discard this patch.