Showing 17 of 17 total issues
Function newAspectSize
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
protected function newAspectSize()
{
$image = $this->editor->image();
$max_width = $this->width;
- 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 calcOffset
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
protected function calcOffset($position)
{
if (is_array($position) && count($position) > 1) {
return [(int) $position[0], (int) $position[1]];
}
- 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 basePath
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
protected function basePath()
{
if (empty($this->basePath)) {
if (empty($_SERVER["DOCUMENT_ROOT"])) {
if ($root = $this->findProjectRoot()) {
- 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 newPath
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function newPath(Image $image, $altName = null)
{
$triesLeft = 5;
do {
if (is_callable($this->pathGenerator)) {
- 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 execute
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
protected function execute()
{
if ($this->stamp && !empty($this->placements)) {
$baseImage = $this->editor->image();
$stamp = $this->stamp;
- 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 execute
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function execute()
{
$image = $this->editor->image();
if (!$this->height && !$this->width && $this->decimalPercent) {
Method newAspectSize
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function newAspectSize()
{
$image = $this->editor->image();
$max_width = $this->width;
Method newPath
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function newPath(Image $image, $altName = null)
{
$triesLeft = 5;
do {
if (is_callable($this->pathGenerator)) {
Method __construct
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct(File $file)
{
$this->file = $file;
if (! $file->exists()) {
throw new \InvalidArgumentException('Cannot open file: ' . $file->filePath());
Method calcOffset
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function calcOffset($position)
{
if (is_array($position) && count($position) > 1) {
return [(int) $position[0], (int) $position[1]];
}
Function offsetFor
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function offsetFor($position)
{
list($positionX, $positionY) = $this->calcOffset($position);
list($anchorX, $anchorY) = $this->element_anchor;
- 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 execute
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected function execute()
{
$image = $this->editor->image();
if (!$this->height && !$this->width && $this->decimalPercent) {
- 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 color
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function color($image)
{
if (is_resource($image)) {
$resource = $image;
} else {
- 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 toRgb
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function toRgb($hexColor, $transparency = 1.0)
{
$hexColor = strtolower($hexColor);
if ($transparency > 1) {
- 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 execute
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function execute()
{
if ($this->angle) {
$image = $this->editor->image()->resource();
- 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 __construct
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function __construct($redOrHex, $green = null, $blue = null, $alpha = 0)
{
if (is_null($green) && is_null($blue)) {
if (is_array($redOrHex)) {
$this->rgbColor = [
- 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 __construct
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function __construct(File $file)
{
$this->file = $file;
if (! $file->exists()) {
throw new \InvalidArgumentException('Cannot open file: ' . $file->filePath());
- 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"