Showing 11 of 11 total issues
File Divider.php
has 251 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* @author: Evgeny Pynykh bpteam22@gmail.com
*/
namespace bpteam\phpOCR;
Function read
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public static function read($imgFile, $template)
{
$img = self::openImg($imgFile);
$imgs = Divider::byChar($img);
$text = '';
- 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 boldText
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
protected static function boldText($img, $bType = self::WIDTH)
{
$colorIndexes = self::getColorsIndexTextAndBackground($img);
$colorTextIndexes = array_flip($colorIndexes['text']);
$width = imagesx($img);
- 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 byLine
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected static function byLine($img)
{
$imgWidth = imagesx($img);
$imgHeight = imagesy($img);
$coordinates = self::coordinatesImg($img);
Function findUniqueChar
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public static function findUniqueChar($imgs)
{
$templateChars = [];
foreach ($imgs as $value) {
//Img::show($value);
- 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 byChar
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function byChar($img)
{
$imgWord = self::byWord($img);
$imgChars = [];
foreach ($imgWord as $lineKey => $lineValue) {
Function generateTemplateChar
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public static function generateTemplateChar($img, $width = 15, $height = 16)
{
if (imagesx($img) != $width || imagesy($img) != $height) {
$img = Img::resize($img, $width, $height);
}
- 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 byLine
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
protected static function byLine($img)
{
$imgWidth = imagesx($img);
$imgHeight = imagesy($img);
$coordinates = self::coordinatesImg($img);
- 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 open
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function open($img)
{
$format = false;
if (strlen($img) < 255 && file_exists($img)) {
$info = getimagesize($img);
- 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 getColorsIndex
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected static function getColorsIndex($img)
{
$colorsIndex = [];
$width = imagesx($img);
$height = imagesy($img);
- 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 byChar
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static function byChar($img)
{
$imgWord = self::byWord($img);
$imgChars = [];
foreach ($imgWord as $lineKey => $lineValue) {
- 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"