Completed
Push — work-fleets ( 88e4e3...4e1f0c )
by SuperNova.WS
12:49
created
classes/V2Fleet/V2FleetModel.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -93,12 +93,12 @@  discard block
 block discarded – undo
93 93
   public function __construct(\Common\GlobalContainer $gc) {
94 94
     parent::__construct($gc);
95 95
 
96
-    $this->accessors->set(P_CONTAINER_SET, 'dbId', function (V2FleetContainer $that, $value) {
96
+    $this->accessors->set(P_CONTAINER_SET, 'dbId', function(V2FleetContainer $that, $value) {
97 97
       $that->setDirect('dbId', $value);
98 98
       $that->location->setLocationId($value);
99 99
     });
100 100
 
101
-    $this->accessors->set(P_CONTAINER_SET, 'ownerId', function (V2FleetContainer $that, $value) {
101
+    $this->accessors->set(P_CONTAINER_SET, 'ownerId', function(V2FleetContainer $that, $value) {
102 102
       $that->setDirect('ownerId', $value);
103 103
       $that->location->setLocationPlayerId($value);
104 104
     });
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
     $this->accessors->set(P_CONTAINER_EXPORT, 'vectorArrive', array($this, 'exportVector'));
110 110
 
111 111
 
112
-    $this->accessors->set(P_CONTAINER_GET, 'location', function (V2FleetContainer $that) {
112
+    $this->accessors->set(P_CONTAINER_GET, 'location', function(V2FleetContainer $that) {
113 113
 //      if (is_null($location = $that->getDirect('location'))) {}
114 114
       $location = new V2Location(LOC_FLEET);
115 115
       $that->setDirect('location', $location);
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
       return $location;
118 118
     }, ACCESSOR_SHARED);
119 119
 
120
-    $this->accessors->set(P_CONTAINER_GET, 'units', function (V2FleetContainer $that) {
120
+    $this->accessors->set(P_CONTAINER_GET, 'units', function(V2FleetContainer $that) {
121 121
 //      if (is_null($units = $that->getDirect('units'))) {}
122 122
       $units = \classSupernova::$gc->unitList;
123 123
       $that->setDirect('units', $units);
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
       return $units;
126 126
     }, ACCESSOR_SHARED);
127 127
 
128
-    $this->accessors->set(P_CONTAINER_GET, 'isReturning', function (V2FleetContainer $that) {
128
+    $this->accessors->set(P_CONTAINER_GET, 'isReturning', function(V2FleetContainer $that) {
129 129
       return $that->status == FLEET_FLAG_RETURNING;
130 130
     });
131 131
 
Please login to merge, or discard this patch.
classes/Common/Accessors.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
    * @return bool
41 41
    */
42 42
   public function exists($accessor, $varName) {
43
-    return isset($this->accessors[$accessor . $varName]);
43
+    return isset($this->accessors[$accessor.$varName]);
44 44
   }
45 45
 
46 46
   /**
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
     if (empty($callable)) {
61 61
       return;
62 62
     } elseif (!is_callable($callable)) {
63
-      throw new \Exception('Error assigning callable in ' . get_called_class() . '::set()! Callable typed [' . $accessor . '] is not a callable or not accessible in the scope');
63
+      throw new \Exception('Error assigning callable in '.get_called_class().'::set()! Callable typed ['.$accessor.'] is not a callable or not accessible in the scope');
64 64
     }
65 65
 
66 66
     // Converting method array-callable to closure
@@ -70,13 +70,13 @@  discard block
 block discarded – undo
70 70
 //      $method = new \ReflectionMethod($callable[0], $callable[1]);
71 71
 //      $callable = $method->getClosure($callable[0]);
72 72
 //    }
73
-    if(is_array($callable) && ($invoker = Invoker::build($callable))) {
73
+    if (is_array($callable) && ($invoker = Invoker::build($callable))) {
74 74
       $callable = $invoker;
75 75
     }
76 76
 
77
-    $functionName = $accessor . $varName;
77
+    $functionName = $accessor.$varName;
78 78
     $this->accessors[$functionName] = $callable;
79
-    if($shared == ACCESSOR_SHARED) {
79
+    if ($shared == ACCESSOR_SHARED) {
80 80
       $this->shared[$functionName] = true;
81 81
     }
82 82
   }
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
    * @return callable|null
92 92
    */
93 93
   public function get($accessor, $varName) {
94
-    return $this->exists($accessor, $varName) ? $this->accessors[$accessor . $varName] : null;
94
+    return $this->exists($accessor, $varName) ? $this->accessors[$accessor.$varName] : null;
95 95
   }
96 96
 
97 97
   /**
@@ -104,11 +104,11 @@  discard block
 block discarded – undo
104 104
    */
105 105
   public function execute($accessor, $varName, $params) {
106 106
     if (!$this->exists($accessor, $varName)) {
107
-      throw new \Exception("No [{$accessor}] accessor found for variable [{$varName}] on " . get_called_class() . "::" . __METHOD__);
107
+      throw new \Exception("No [{$accessor}] accessor found for variable [{$varName}] on ".get_called_class()."::".__METHOD__);
108 108
     }
109 109
 
110
-    $functionName = $accessor . $varName;
111
-    if(!isset($this->shared[$functionName]) || !array_key_exists($functionName, $this->executed)) {
110
+    $functionName = $accessor.$varName;
111
+    if (!isset($this->shared[$functionName]) || !array_key_exists($functionName, $this->executed)) {
112 112
       $this->executed[$functionName] = call_user_func_array($this->accessors[$functionName], $params);
113 113
     }
114 114
 
Please login to merge, or discard this patch.