Function create
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function create( $class, array $data = array(), array $options = array() ) {
foreach ( $this->repositories as $interface => $repository ) {
if ( is_subclass_of( $class, $interface ) ) {
$model = $repository->create( $class, $data, $options );
- 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 persist
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function persist( Model $model ) {
foreach ( $this->repositories as $interface => $repository ) {
if ( is_subclass_of( $model, $interface ) ) {
$model = $repository->persist( $model );
- 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 7 (exceeds 5 allowed). Consider refactoring. Open
public function find( $class, $id, array $params = array() ) {
if ( ! is_subclass_of( $class, 'Intraxia\Jaxion\Axolotl\Model' ) ) {
return new WP_Error( 'invalid_model', __( 'Invalid model', 'wp-gistpen' ) );
}
- 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_by
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function find_by( $class, array $params = array() ) {
if ( ! is_subclass_of( $class, 'Intraxia\Jaxion\Axolotl\Model' ) ) {
return new WP_Error( 'invalid_model', __( 'Invalid model', 'wp-gistpen' ) );
}
- 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 6 (exceeds 5 allowed). Consider refactoring. Open
public function delete( Model $model, $force = false ) {
foreach ( $this->repositories as $interface => $repository ) {
if ( is_subclass_of( $model, $interface ) ) {
$model = $repository->delete( $model, $force );
- 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"