Showing 13 of 153 total issues
Method AdjacentCellsProvider
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function AdjacentCellsProvider() : array
{
$battlefield = MockFactory::getBattlefieldMock();
$battlefield->getCellByCoordinate('A2')->setFlags(CellModel::FLAG_DEAD);
Method successfulInitAction_XML
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function successfulInitAction_XML()
{
$client = static::$client;
$client->request(
Request::METHOD_POST,
Method successfulInitAction_JSON
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function successfulInitAction_JSON()
{
$client = static::$client;
$client->request(
Request::METHOD_POST,
Method processPathsComplete
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function processPathsComplete()
{
$battlefield = MockFactory::getBattlefieldMock();
$battlefield->getCellByCoordinate('B2')->setFlags(CellModel::FLAG_DEAD_SHIP);
Function successfulTurnAction
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function successfulTurnAction(array $response)
{
foreach ($response as $battlefield) {
if ($battlefield->player->flags !== PlayerModel::FLAG_AI_CONTROLLED) {
continue;
- 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 getAdjacentCells
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public function getAdjacentCells(string $initCoordinate, array $expectedCoordinates, Battlefield $battlefield, int $levels, int $onlyFlag, int $excludeFlag)
Function processPath
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected function processPath(Battlefield $battlefield, int $path, string $coordinate) : Cell
{
$processor = (new PathProcessor($coordinate))->setPath($path);
while (null !== $cell = $battlefield->getCellByCoordinate($processor->calculateNextCoordinate())) {
- 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 successfulInitAction_XML
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function successfulInitAction_XML()
{
$client = static::$client;
$client->request(
Request::METHOD_POST,
- 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 unsuccessfulTurnActionOnDeadCell
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function unsuccessfulTurnActionOnDeadCell(array $response)
{
foreach ($response as $battlefield) {
if ($battlefield->player->flags === PlayerModel::FLAG_AI_CONTROLLED) {
foreach ($battlefield->cells as $cell) {
- 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 getAdjacentCells
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function getAdjacentCells(Battlefield $battlefield, int $levels = 1, int $onlyFlag = CellModel::FLAG_NONE, int $excludeFlag = CellModel::FLAG_NONE) : array
{
$cells = [];
foreach (static::$extendedPaths as $path) {
$this->setPath($path);
- 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 chooseStrategy
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function chooseStrategy(Cell $cell) : int
{
$processor = new PathProcessor($cell->getCoordinate());
$battlefield = $cell->getBattlefield();
- 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 addBattlefield
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function addBattlefield()
{
$game = MockFactory::getGameMock();
$game->getBattlefields()[0]
->setPlayer(MockFactory::getAIPlayerMock(''))
- 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 processPlayerTurnOnBattlefields
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function processPlayerTurnOnBattlefields(Game $game, Player $attacker, Cell $cell) : bool
{
foreach ($game->getBattlefields() as $battlefield) {
try {
if ($this->processPlayerTurnOnBattlefield($battlefield, $attacker, $cell)) {
- 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"