Showing 20 of 20 total issues
Function createEntity
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
private function createEntity($className, array $data)
{
$class = $this->em->getClassMetadata($className);
$entity = $class->newInstance();
- 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 find
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
public function find($className, $id, $revision)
{
if (!$this->metadataFactory->isAudited($className)) {
throw Exception::notAudited($className);
}
- 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
Configuration
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
class Configuration
{
private $prefix = '';
private $suffix = '_audit';
private $revisionFieldName = 'rev';
File Reader.php
has 271 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace ZF2EntityAudit\Audit;
use Doctrine\DBAL\Types\Type;
use Doctrine\ORM\EntityManager;
Function findEntitesChangedAtRevision
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function findEntitesChangedAtRevision($revision)
{
$auditedEntities = $this->metadataFactory->getAllClassNames();
$changedEntities = array();
- 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 saveRevisionEntityData
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function saveRevisionEntityData($class, $entityData, $revType)
{
$params = array($this->getRevisionId(), $revType);
$types = array(\PDO::PARAM_INT, \PDO::PARAM_STR);
- 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 find
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function find($className, $id, $revision)
{
if (!$this->metadataFactory->isAudited($className)) {
throw Exception::notAudited($className);
}
Method updateAction
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function updateAction()
{
echo "- before starting : 1- please take a backup \n";
echo " 2- update the all `anonymous` in the revisions table to some exsited user \n";
echo "- cancel this command and update it then restart it again \n";
Function findRevisions
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function findRevisions($className, $id)
{
if (!$this->metadataFactory->isAudited($className)) {
throw Exception::notAudited($className);
}
- 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 getInsertRevisionSQL
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
private function getInsertRevisionSQL($class)
{
if (!isset($this->insertRevisionSQL[$class->name])) {
$placeholders = array('?', '?');
$tableName = $this->config->getTablePrefix() . $class->table['name'] . $this->config->getTableSuffix();
- 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 createEntity
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function createEntity($className, array $data)
{
$class = $this->em->getClassMetadata($className);
$entity = $class->newInstance();
Method getServiceConfig
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getServiceConfig()
{
return array(
'factories' => array(
'auditConfig' => function($sm){
Method findRevisions
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function findRevisions($className, $id)
{
if (!$this->metadataFactory->isAudited($className)) {
throw Exception::notAudited($className);
}
Method findEntitesChangedAtRevision
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function findEntitesChangedAtRevision($revision)
{
$auditedEntities = $this->metadataFactory->getAllClassNames();
$changedEntities = array();
Method createInitialRevisionsAction
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function createInitialRevisionsAction()
{
$request = $this->getRequest();
if (!$request instanceof ConsoleRequest) {
throw new RuntimeException('You can only use this action from a console!');
Method getViewHelperConfig
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getViewHelperConfig()
{
return array(
'factories' => array(
'DateTimeFormatter' => function($sm) {
Function createInitialRevisionsAction
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function createInitialRevisionsAction()
{
$request = $this->getRequest();
if (!$request instanceof ConsoleRequest) {
throw new RuntimeException('You can only use this action from a console!');
- 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 __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function __construct($rev, $timestamp, $user , $note = '' , $ipaddress = '')
Method revertBack
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function revertBack(EntityManager $em,$className,$id,$oldRevId,$newRevId)
Function diff
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function diff(array $old, array $new)
{
$maxlen = 0;
foreach ($old as $oindex => $ovalue) {
$nkeys = array_keys($new, $ovalue);
- 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"