@@ -20,14 +20,14 @@ discard block |
||
| 20 | 20 | use yii\web\BadRequestHttpException; |
| 21 | 21 | |
| 22 | 22 | |
| 23 | -class HitCounterService extends Component{ |
|
| 23 | +class HitCounterService extends Component { |
|
| 24 | 24 | |
| 25 | 25 | use RequestTrait; |
| 26 | 26 | |
| 27 | 27 | private $deviceDetector; |
| 28 | 28 | private $repoHitCounter; |
| 29 | 29 | |
| 30 | - public function __construct(IDeviceDetect $dd, HitCounterRepository $hcr, $config = []) |
|
| 30 | + public function __construct(IDeviceDetect $dd, HitCounterRepository $hcr, $config = []) |
|
| 31 | 31 | { |
| 32 | 32 | $this->deviceDetector = $dd; |
| 33 | 33 | $this->repoHitCounter = $hcr; |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | public function create(HitCounterModel $model, string $entityClass = HitCounter::class): HitCounter |
| 39 | 39 | {var_dump($entityClass); |
| 40 | - $dto = (new HitCounterModelDtoAssembler())->writeDto($model);//dto |
|
| 40 | + $dto = (new HitCounterModelDtoAssembler())->writeDto($model); //dto |
|
| 41 | 41 | $hit = (new HitCounterDtoAssembler($entityClass))->readDto($dto); |
| 42 | 42 | |
| 43 | 43 | $this->repoHitCounter->save($hit); |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | $array = $request->get(); |
| 58 | 58 | $data = []; |
| 59 | 59 | |
| 60 | - if(isset($array['i'])){ |
|
| 60 | + if (isset($array['i'])) { |
|
| 61 | 61 | $data['counter_id'] = $array['i']; |
| 62 | 62 | $data['js_cookei_enabled'] = ArrayHelper::getValue($array, 'c', 0); |
| 63 | 63 | $data['js_java_enabled'] = ArrayHelper::getValue($array, 'j', 0); |
@@ -69,13 +69,13 @@ discard block |
||
| 69 | 69 | $data['js_screen_width'] = ArrayHelper::getValue($array, 'w'); |
| 70 | 70 | $data['js_screen_height'] = ArrayHelper::getValue($array, 'h'); |
| 71 | 71 | $data['js_color_depth'] = ArrayHelper::getValue($array, 'd'); |
| 72 | - $data['js_browser_language']= ArrayHelper::getValue($array, 'lg'); |
|
| 72 | + $data['js_browser_language'] = ArrayHelper::getValue($array, 'lg'); |
|
| 73 | 73 | $data['js_history_length'] = ArrayHelper::getValue($array, 'hl'); |
| 74 | - $data['js_is_toutch_device']= ArrayHelper::getValue($array, 'td', 0); |
|
| 74 | + $data['js_is_toutch_device'] = ArrayHelper::getValue($array, 'td', 0); |
|
| 75 | 75 | $data['js_processor_ram'] = ArrayHelper::getValue($array, 'ram'); |
| 76 | 76 | |
| 77 | 77 | return $data; |
| 78 | - }else{ |
|
| 78 | + }else { |
|
| 79 | 79 | throw new BadRequestHttpException('required get param "i" cannot be empty.'); |
| 80 | 80 | } |
| 81 | 81 | |
@@ -122,9 +122,9 @@ discard block |
||
| 122 | 122 | |
| 123 | 123 | $name = static::defaultNameCookieMark(); |
| 124 | 124 | |
| 125 | - if ($request->cookies->has($name)){ |
|
| 125 | + if ($request->cookies->has($name)) { |
|
| 126 | 126 | return $request->cookies->getValue($name); |
| 127 | - }else{ |
|
| 127 | + }else { |
|
| 128 | 128 | $str = Yii::$app->getSecurity()->generateRandomString(); |
| 129 | 129 | |
| 130 | 130 | // add to HTTP |