File Release.php
has 756 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace thcolin\SceneReleaseParser;
use Mhor\MediaInfo\MediaInfo;
Function analyse
has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring. Open
public static function analyse($path, $config = []){
if(!is_file($path)){
throw new InvalidArgumentException("File '".$path."' not found");
}
- 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
Release
has 45 functions (exceeds 20 allowed). Consider refactoring. Open
class Release{
const MOVIE = 'movie';
const TVSHOW = 'tvshow';
Method analyse
has 94 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function analyse($path, $config = []){
if(!is_file($path)){
throw new InvalidArgumentException("File '".$path."' not found");
}
Function parseLanguage
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private function parseLanguage(&$title){
$languages = [];
foreach(self::$languageStatic as $langue => $patterns){
if(!is_array($patterns)){
- 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 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct($name, $strict = true, $defaults = []){
foreach($defaults as $key => $default){
$const = $key.'Static';
if(property_exists(get_class(), $const) && !in_array($default, array_keys(self::$$const))){
Function guessResolution
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function guessResolution(){
if($this -> resolution){
return $this -> resolution;
} else if($this->getSource() == self::SOURCE_BLURAY || $this->getSource() == self::SOURCE_BDSCR){
return self::RESOLUTION_1080P;
- 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 parseAttribute
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function parseAttribute(&$title, $attribute){
if(!in_array($attribute, [self::SOURCE, self::ENCODING, self::RESOLUTION, self::DUB])){
throw new InvalidArgumentException();
}
- 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 parseFlags
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function parseFlags(&$title){
$flags = [];
foreach(self::$flagsStatic as $key => $patterns){
if(!is_array($patterns)){
- 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 __toString
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function __toString(){
$arrays = [];
foreach([
$this -> getTitle(),
$this -> getYear(),
- 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"