Selaa lähdekoodia

Merge branch 'stats_command#1' into 'master'

Stats command#1

See merge request interlink-sa/flowdat3/modules/stats_command!7
Jean Sumara Leopoldo 5 vuotta sitten
vanhempi
commit
9abcb3354c
2 muutettua tiedostoa jossa 5 lisäystä ja 8 poistoa
  1. 2 5
      src/App/Service/Huawei/HuaweiOltService.php
  2. 3 3
      src/Domain/Huawei.php

+ 2 - 5
src/App/Service/Huawei/HuaweiOltService.php

@@ -13,17 +13,14 @@ class HuaweiOltService
      */
     private $huawei;
     private $sendData;
-    private $stats;
 
     /**
      * HuaweiOltService constructor.
      * @param $sendData
-     * @param $stats
      */
     public function __construct(&$sendData)
     {
         $this->sendData = &$sendData;
-        $this->stats = &$stats;
     }
 
     public function configure(Huawei $huawei){
@@ -39,7 +36,7 @@ class HuaweiOltService
             $v = $data[$this->huawei->getIndex()] * 0.01;
             $this->sendData[$m] = "{$v}|g";
 
-            $this->stats[$metricName] = $v;
+            $this->huawei->stats[$metricName] = $v;
         }
 
         return $this;
@@ -53,7 +50,7 @@ class HuaweiOltService
             $v = $data[$this->huawei->getIndex()];
             $this->sendData[$m] = "{$v}|g";
 
-            $this->stats[$metricName] = $v;
+            $this->huawei->stats[$metricName] = $v;
         }
 
         return $this;

+ 3 - 3
src/Domain/Huawei.php

@@ -9,7 +9,7 @@ class Huawei implements AbstractOnu
     private $index;
     private $sn;
     private $ponPort;
-    private $stats;
+    public $stats;
 
     /**
      * Huawei constructor.
@@ -18,12 +18,12 @@ class Huawei implements AbstractOnu
      * @param $ponPort
      * @param $stats
      */
-    public function __construct($index, $sn, $ponPort = null, $stats = null)
+    public function __construct($index, $sn, $ponPort = null, &$stats = null)
     {
         $this->index = $index;
         $this->sn = $sn;
         $this->ponPort = $ponPort;
-        $this->stats = $stats;
+        $this->stats = &$stats;
     }
 
     /**