Showing 87 of 92 total issues
Method processNumeric
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function processNumeric($data, $path)
{
if ($this->multipleOf !== null) {
$div = $data / $this->multipleOf;
if ($div != (int)$div && ($div = $data * (1 / $this->multipleOf)) && ($div != (int)$div)) {
Wrapper
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class Wrapper implements SchemaContract, MetaHolder, SchemaExporter, \JsonSerializable
{
/** @var Schema */
private $schema;
Function isValid
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public static function isValid($types, $data, $version)
{
if (!is_array($types)) {
$types = array($types);
}
- 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 processString
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
private function processString($data, $path)
{
if ($this->minLength !== null) {
if (mb_strlen($data, 'UTF-8') < $this->minLength) {
$this->fail((new StringException('String is too short', StringException::TOO_SHORT))
- 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 validationError
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function validationError($data, $options = 0)
{
if ($options === Uri::IS_URI_TEMPLATE) {
$opened = false;
for ($i = 0; $i < strlen($data); ++$i) {
Function readString
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public static function readString($types, &$data)
{
if (!is_array($types)) {
$types = array($types);
}
- 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 preProcessReferences
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function preProcessReferences($data, Context $options, $nestingLevel = 0)
{
if ($nestingLevel > 200) {
throw new Exception('Too deep nesting level', Exception::DEEP_NESTING);
}
- 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 processOneOf
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
private function processOneOf($data, Context $options, $path)
{
$successes = 0;
$failures = '';
$subErrors = [];
- 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 process
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function process(Context $options, $encoding, $mediaType, $data, $import = true)
{
if ($import) {
if ($encoding !== null) {
switch ($encoding) {
Method processOneOf
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function processOneOf($data, Context $options, $path)
{
$successes = 0;
$failures = '';
$subErrors = [];
Function processConst
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private function processConst($data, $path)
{
if ($this->const !== $data &&
!( // Int and float equality.
(is_int($this->const) || is_float($this->const)) &&
- 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 validationError
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function validationError($format, $data)
{
switch ($format) {
case self::DATE_TIME:
return self::dateTimeError($data);
Function resolveURI
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public static function resolveURI($parent, $current)
{
if ($current === '') {
return $parent;
}
- 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 jsonSerialize
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
$result = new \stdClass();
$schema = static::schema();
Method provider
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function provider($path)
{
$testCases = array();
if ($handle = opendir($path)) {
Method provider
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function provider($path)
{
$testCases = array();
if ($handle = opendir($path)) {
Method isValid
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function isValid($types, $data, $version)
{
if (!is_array($types)) {
$types = array($types);
}
Method readString
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function readString($types, &$data)
{
if (!is_array($types)) {
$types = array($types);
}
Method getSchemaPointers
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getSchemaPointers($path, $isURIFragmentId = false)
{
$items = explode('->', $path);
unset($items[0]);
$result = array();
Function isValid
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public static function isValid(array $data)
{
$index = array();
foreach ($data as $value) {
if (is_array($value) || $value instanceof \stdClass) {
- 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"