Showing 21 of 128 total issues
Method testCreateFromArray
has 109 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testCreateFromArray()
{
$messageParser = new MessageParser();
// Test with bad keys
Method testSend
has 108 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testSend()
{
$webSocketClient = new WebSocketClient('ws://localhost:8080');
// Backup the Textalk WebSocket client
Method testAuthorizeSend
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testAuthorizeSend()
{
// Test without metadata parameters on request
$this->assertFalse(
ApplicationsAuthManager::factory()->authorizeSend(
Method testAuthorizeOpen
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testAuthorizeOpen()
{
// Test without specifying `authorizeOpen` explicitly
$this->assertTrue(ApplicationsAuthManager::factory()->authorizeOpen($this->createIoConnection()));
Function findByTags
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function findByTags(array $tags = [])
{
$objects = [];
// If no tags are provided we return all the objects
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method testConstruct
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testConstruct()
{
$ioConnection = $this->createIoConnection();
$webSocketRequest = WebSocketRequest::factory('Hello World !');
Method testFindByTags
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testFindByTags()
{
$object0 = new \DateTime();
$object1 = new \DateTime();
$object2 = new \DateTime();
Function createFromArray
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public static function createFromArray(array $jsonArray, IMessageParser $messageParser = null)
{
// Ensure the array contains only valid key names
foreach (array_keys($jsonArray) as $key) {
if (!is_string($key) || !in_array($key, ['message', 'tags', 'metadata'])) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method testCreateFromJSON
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testCreateFromJSON()
{
$messageParser = new MessageParser();
// Test with an invalid JSON string
Method createFromArray
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function createFromArray(array $jsonArray, IMessageParser $messageParser = null)
{
// Ensure the array contains only valid key names
foreach (array_keys($jsonArray) as $key) {
if (!is_string($key) || !in_array($key, ['message', 'tags', 'metadata'])) {
Method testDelete
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testDelete()
{
$object0 = new \DateTime();
$object1 = new \DateTime();
$object2 = new \DateTime();
Method parseYamlString
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function parseYamlString($yamlString)
{
// Parse the YAML file
$yamlParser = new Parser();
Method onMessage
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function onMessage(ConnectionInterface $connection, $strMessage)
{
// In development mode we log a message
$this->logger->debug(
'Receiving message on WebSocket connection with resource id \'{resourceId}\'.',
Method testAdd
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testAdd()
{
$tagsTree = new TagsTree();
// Test with an invalid tag key (i.e not a string)
Function parse
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public static function parse(QueryString $queryString)
{
$tags = [];
$queryStringArray = $queryString->toArray();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function delete
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function delete($object)
{
if ($this->contains($object)) {
// Computes the object hash
$hash = $this->objects->getHash($object);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function parse
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function parse(array $arrayMessage)
{
// Ensure the array contains only valid key names
foreach (array_keys($arrayMessage) as $key) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function parseYamlString
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
protected function parseYamlString($yamlString)
{
// Parse the YAML file
$yamlParser = new Parser();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function authorizeOpen
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function authorizeOpen(ConnectionInterface $connection)
{
$authorized = $this->authorizeOpen;
// If the default connection opening authorization mode is false then try to get specific 'key' and 'secret'
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function validateTags
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function validateTags(array $tags)
{
foreach ($tags as $tagName => $tagValue) {
// Tag names must only be strings
if (!is_string($tagName)) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"