Skip to content

Commit

Permalink
solved warnings in linting
Browse files Browse the repository at this point in the history
  • Loading branch information
mmelograno committed Feb 2, 2024
1 parent 10a87c6 commit 465ac4d
Show file tree
Hide file tree
Showing 91 changed files with 241 additions and 148 deletions.
1 change: 1 addition & 0 deletions src/SplitIO/Component/Cache/CacheKeyTrait.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace SplitIO\Component\Cache;

/**
Expand Down
5 changes: 3 additions & 2 deletions src/SplitIO/Component/Cache/EventsCache.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace SplitIO\Component\Cache;

use SplitIO\Component\Common\Context;
Expand All @@ -7,7 +8,7 @@

class EventsCache
{
const KEY_EVENTS_LIST = "SPLITIO.events";
private const KEY_EVENTS_LIST = "SPLITIO.events";

/**
* @var \SplitIO\Component\Cache\Pool
Expand All @@ -26,7 +27,7 @@ public function addEvent(EventQueueMessage $message)
{
$queueJSONmessage = json_encode($message->toArray());

Context::getLogger()->debug("Adding event item into queue: ". $queueJSONmessage);
Context::getLogger()->debug("Adding event item into queue: " . $queueJSONmessage);
return ($this->cache->rightPushInList(self::KEY_EVENTS_LIST, $queueJSONmessage) > 0);
}
}
7 changes: 4 additions & 3 deletions src/SplitIO/Component/Cache/ImpressionCache.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace SplitIO\Component\Cache;

use SplitIO\Component\Common\Context;
Expand All @@ -7,8 +8,8 @@

class ImpressionCache
{
const IMPRESSIONS_QUEUE_KEY = "SPLITIO.impressions";
const IMPRESSION_KEY_DEFAULT_TTL = 3600;
public const IMPRESSIONS_QUEUE_KEY = "SPLITIO.impressions";
public const IMPRESSION_KEY_DEFAULT_TTL = 3600;

/**
* @var \SplitIO\Component\Cache\Pool
Expand Down Expand Up @@ -43,7 +44,7 @@ function ($imp) use ($metadata) {
$impressions
);

Context::getLogger()->debug("Adding impressions into queue: ". implode(",", $toStore));
Context::getLogger()->debug("Adding impressions into queue: " . implode(",", $toStore));
$count = $this->cache->rightPushInList(self::IMPRESSIONS_QUEUE_KEY, $toStore);
if ($count == count($impressions)) {
$this->cache->expireKey(self::IMPRESSIONS_QUEUE_KEY, self::IMPRESSION_KEY_DEFAULT_TTL);
Expand Down
1 change: 1 addition & 0 deletions src/SplitIO/Component/Cache/Pool.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace SplitIO\Component\Cache;

use SplitIO\Component\Cache\Storage\Adapter\PRedis as PRedisAdapter;
Expand Down
5 changes: 3 additions & 2 deletions src/SplitIO/Component/Cache/SegmentCache.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<?php

namespace SplitIO\Component\Cache;

class SegmentCache implements SegmentCacheInterface
{
const KEY_SEGMENT_DATA = 'SPLITIO.segment.{segmentName}';
public const KEY_SEGMENT_DATA = 'SPLITIO.segment.{segmentName}';

const KEY_TILL_CACHED_ITEM = 'SPLITIO.segment.{segment_name}.till';
public const KEY_TILL_CACHED_ITEM = 'SPLITIO.segment.{segment_name}.till';

/**
* @var \SplitIO\Component\Cache\Pool
Expand Down
1 change: 1 addition & 0 deletions src/SplitIO/Component/Cache/SegmentCacheInterface.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace SplitIO\Component\Cache;

interface SegmentCacheInterface
Expand Down
9 changes: 5 additions & 4 deletions src/SplitIO/Component/Cache/SplitCache.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
<?php

namespace SplitIO\Component\Cache;

class SplitCache implements SplitCacheInterface
{
const KEY_TILL_CACHED_ITEM = 'SPLITIO.splits.till';
public const KEY_TILL_CACHED_ITEM = 'SPLITIO.splits.till';

const KEY_SPLIT_CACHED_ITEM = 'SPLITIO.split.{splitName}';
public const KEY_SPLIT_CACHED_ITEM = 'SPLITIO.split.{splitName}';

const KEY_TRAFFIC_TYPE_CACHED = 'SPLITIO.trafficType.{trafficTypeName}';
public const KEY_TRAFFIC_TYPE_CACHED = 'SPLITIO.trafficType.{trafficTypeName}';

const KEY_FLAG_SET_CACHED = 'SPLITIO.flagSet.{set}';
public const KEY_FLAG_SET_CACHED = 'SPLITIO.flagSet.{set}';

/**
* @var \SplitIO\Component\Cache\Pool
Expand Down
1 change: 1 addition & 0 deletions src/SplitIO/Component/Cache/SplitCacheInterface.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace SplitIO\Component\Cache;

interface SplitCacheInterface
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace SplitIO\Component\Cache\Storage\Adapter;

interface CacheStorageAdapterInterface
Expand Down
9 changes: 6 additions & 3 deletions src/SplitIO/Component/Cache/Storage/Adapter/PRedis.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace SplitIO\Component\Cache\Storage\Adapter;

use SplitIO\Component\Cache\Storage\Exception\AdapterException;
Expand Down Expand Up @@ -59,9 +60,11 @@ private function validateKeyHashTag($keyHashTag)
if (!is_string($keyHashTag)) {
return array('valid' => false, 'msg' => 'keyHashTag must be string.');
}
if ((strlen($keyHashTag) < 3) || ($keyHashTag[0] != "{") ||
if (
(strlen($keyHashTag) < 3) || ($keyHashTag[0] != "{") ||
(substr($keyHashTag, -1) != "}") || (substr_count($keyHashTag, "{") != 1) ||
(substr_count($keyHashTag, "}") != 1)) {
(substr_count($keyHashTag, "}") != 1)
) {
return array('valid' => false, 'msg' => 'keyHashTag is not valid.');
}
return array('valid' => true, 'msg' => '');
Expand Down Expand Up @@ -205,7 +208,7 @@ private static function normalizePrefix($prefix)
if ($prefix[strlen($prefix) - 1] == '.') {
return $prefix;
} else {
return $prefix.'.';
return $prefix . '.';
}
} else {
return null;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace SplitIO\Component\Cache\Storage\Adapter;

use SplitIO\Component\Common\Context;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace SplitIO\Component\Cache\Storage\Exception;

class AdapterException extends \Exception
Expand Down
5 changes: 3 additions & 2 deletions src/SplitIO/Component/Common/Context.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace SplitIO\Component\Common;

use SplitIO\Component\Log\Logger;
Expand All @@ -10,11 +11,11 @@
*/
class Context
{
const SAME_SDK_KEY = "Factory Instantiation: You already have %s factory/factories with this SDK Key. "
private const SAME_SDK_KEY = "Factory Instantiation: You already have %s factory/factories with this SDK Key. "
. "We recommend keeping only one instance of the factory at all times (Singleton pattern) and "
. "reusing it throughout your application.";

const MULTIPLE_INSTANCES = "Factory Instantiation: You already have an instance of the Split factory. "
private const MULTIPLE_INSTANCES = "Factory Instantiation: You already have an instance of the Split factory. "
. "Make sure you definitely want this additional instance. We recommend keeping only one instance of "
. "the factory at all times (Singleton pattern) and reusing it throughout your application.";

Expand Down
2 changes: 2 additions & 0 deletions src/SplitIO/Component/Common/Enum.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<?php

/**
* @link http://github.com/myclabs/php-enum
* @license http://www.opensource.org/licenses/mit-license.php MIT (see the LICENSE file)
*/

namespace SplitIO\Component\Common;

/**
Expand Down
2 changes: 1 addition & 1 deletion src/SplitIO/Component/Common/ErrorHandler.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php

namespace SplitIO\Component\Common;

use ErrorException;

class ErrorHandler
{

/**
* Errors stack
* @var array
Expand Down
1 change: 1 addition & 0 deletions src/SplitIO/Component/Initialization/LoggerFactory.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace SplitIO\Component\Initialization;

use Psr\Log\LogLevel;
Expand Down
1 change: 1 addition & 0 deletions src/SplitIO/Component/Log/Handler/Echos.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace SplitIO\Component\Log\Handler;

/**
Expand Down
1 change: 1 addition & 0 deletions src/SplitIO/Component/Log/Handler/LogHandlerInterface.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace SplitIO\Component\Log\Handler;

/**
Expand Down
1 change: 1 addition & 0 deletions src/SplitIO/Component/Log/Handler/Stdout.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace SplitIO\Component\Log\Handler;

/**
Expand Down
1 change: 1 addition & 0 deletions src/SplitIO/Component/Log/Handler/Syslog.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace SplitIO\Component\Log\Handler;

use Psr\Log\LogLevel;
Expand Down
1 change: 1 addition & 0 deletions src/SplitIO/Component/Log/Handler/VoidHandler.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace SplitIO\Component\Log\Handler;

/**
Expand Down
17 changes: 9 additions & 8 deletions src/SplitIO/Component/Log/LogLevelEnum.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
<?php

namespace SplitIO\Component\Log;

use SplitIO\Component\Common\Enum;

class LogLevelEnum extends Enum
{
const EMERGENCY = 'emergency';
const ALERT = 'alert';
const CRITICAL = 'critical';
const ERROR = 'error';
const WARNING = 'warning';
const NOTICE = 'notice';
const INFO = 'info';
const DEBUG = 'debug';
public const EMERGENCY = 'emergency';
public const ALERT = 'alert';
public const CRITICAL = 'critical';
public const ERROR = 'error';
public const WARNING = 'warning';
public const NOTICE = 'notice';
public const INFO = 'info';
public const DEBUG = 'debug';
}
5 changes: 3 additions & 2 deletions src/SplitIO/Component/Log/Logger.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php

namespace SplitIO\Component\Log;

use Psr\Log\LogLevel;
use \SplitIO\Component\Log\Handler\LogHandlerInterface;
use SplitIO\Component\Log\Handler\LogHandlerInterface;
use SplitIO\Component\Log\Handler\VoidHandler;

/**
Expand All @@ -15,7 +16,7 @@ class Logger extends LoggerTrait
/**
* @var null|LogHandlerInterface
*/
protected $handler=null;
protected $handler = null;

/**
* @var null
Expand Down
1 change: 1 addition & 0 deletions src/SplitIO/Component/Log/LoggerTrait.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace SplitIO\Component\Log;

use Psr\Log\LogLevel;
Expand Down
1 change: 1 addition & 0 deletions src/SplitIO/Component/Log/PSR3LoggerAdapter.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace SplitIO\Component\Log;

use Psr\Log\LoggerInterface;
Expand Down
3 changes: 2 additions & 1 deletion src/SplitIO/Component/Stats/Latency.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<?php

namespace SplitIO\Component\Stats;

class Latency
{
const MAX_LATENCY = 7481828;
public const MAX_LATENCY = 7481828;

private static $buckets = array(1000, 1500, 2250, 3375, 5063, 7594, 11391, 17086, 25629, 38443,
57665, 86498, 129746, 194620, 291929, 437894, 656841, 985261, 1477892, 2216838,
Expand Down
5 changes: 3 additions & 2 deletions src/SplitIO/Engine.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace SplitIO;

use SplitIO\Grammar\Split as SplitGrammar;
Expand All @@ -8,9 +9,9 @@

class Engine
{
const EVALUATION_RESULT_TREATMENT = 'treatment';
public const EVALUATION_RESULT_TREATMENT = 'treatment';

const EVALUATION_RESULT_LABEL = 'label';
public const EVALUATION_RESULT_LABEL = 'label';

/**
* @param $matchingKey
Expand Down
5 changes: 3 additions & 2 deletions src/SplitIO/Engine/Hash/HashAlgorithmEnum.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php

namespace SplitIO\Engine\Hash;

use SplitIO\Component\Common\Enum;

class HashAlgorithmEnum extends Enum
{
const LEGACY = 1;
const MURMUR = 2;
public const LEGACY = 1;
public const MURMUR = 2;
}
1 change: 1 addition & 0 deletions src/SplitIO/Engine/Hash/HashInterface.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace SplitIO\Engine\Hash;

interface HashInterface
Expand Down
Loading

0 comments on commit 465ac4d

Please sign in to comment.