YetiForceCompany/YetiForceCRM

View on GitHub
app/Json.php

Summary

Maintainability
A
0 mins
Test Coverage
A
100%

Missing class import via use statement (line '45', column '13').
Open

        throw new \App\Exceptions\AppException('ERR_NO_JSON_DECODE');
Severity: Minor
Found in app/Json.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '68', column '13').
Open

        throw new \App\Exceptions\AppException('ERR_NO_JSON_ENCODE');
Severity: Minor
Found in app/Json.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Argument 2 (assoc) is int but \json_decode() takes bool
Open

            return json_decode($encodedValue, $objectDecodeType);
Severity: Minor
Found in app/Json.php by phan

Argument 2 (objectDecodeType) is true but \App\Json::decode() takes int defined at /code/app/Json.php:37
Open

        return static::decode(file_get_contents($path), true) ?? [];
Severity: Minor
Found in app/Json.php by phan

Spaces must be used to indent lines; tabs are not allowed
Open

    const TYPE_ARRAY = 1;
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @see https://secure.php.net/manual/en/function.json-decode.php
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        throw new \App\Exceptions\AppException('ERR_NO_JSON_DECODE');
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    }
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        throw new \App\Exceptions\AppException('ERR_NO_JSON_ENCODE');
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    {
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    {
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param int    $objectDecodeType Optional; When TRUE, returned objects will be converted into associative arrays
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     */
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    }
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     */
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        }
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @return bool
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        return empty($value) || '[]' === $value || '""' === $value;
Severity: Minor
Found in app/Json.php by phpcodesniffer

Line exceeds 120 characters; contains 126 characters
Open

        return !(null === $value || '' === $value || null === self::decode($value) || JSON_ERROR_NONE !== \json_last_error());
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    {
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param mixed $valueToEncode
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param int   $options       Optional; whether or not to check for object recursion; off by default
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param string|null $value
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    public static function isEmpty(?string $value)
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @return bool
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     */
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    }
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            return '';
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        }
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * Check that a string is a valid JSON string.
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        }
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     */
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * encoded in the JSON format.
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    /**
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    /**
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @return mixed
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * NOTE: Object should not contain cycles; the JSON format
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        if (null === $encodedValue) {
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    const TYPE_OBJECT = 0;
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    public static function decode($encodedValue, $objectDecodeType = self::TYPE_ARRAY)
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * NOTE: Only public variables will be encoded
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    {
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        if (\function_exists('json_encode')) {
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * ext/json's functions.
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * Decodes the given $encodedValue string which is
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * Encode the mixed $valueToEncode into the JSON format.
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * Encodes using ext/json's json_encode() if available.
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        return !(null === $value || '' === $value || null === self::decode($value) || JSON_ERROR_NONE !== \json_last_error());
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * How objects should be encoded -- arrays or as StdClass. TYPE_ARRAY is 1
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    }
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * Determine whether a variable is empty.
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param string|null $value
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * so that it is a boolean true value, allowing it to be used with
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        if (\function_exists('json_decode')) {
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @return string JSON encoded object
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    public static function isJson(?string $value): bool
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param string $encodedValue     Encoded in JSON format
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * does not allow object reference.
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * Read json file to array.
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @throws \App\Exceptions\AppException
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @throws \App\Exceptions\AppException
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    /**
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     */
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            return json_decode($encodedValue, $objectDecodeType);
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    /**
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            return json_encode($valueToEncode, $options | JSON_UNESCAPED_UNICODE);
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param string $path
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * Uses ext/json's json_decode if available.
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    public static function encode($valueToEncode, $options = 0)
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    /**
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    {
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    public static function save(string $path, array $data)
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    public static function read(string $path)
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    }
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    /**
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        return static::decode(file_get_contents($path), true) ?? [];
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    }
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * Save json file from array.
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    {
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        return \file_put_contents($path, static::encode($data, JSON_PRETTY_PRINT), LOCK_EX);
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     */
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param string $path
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    /**
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @return bool|int
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @return array
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     */
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param array  $data
Severity: Minor
Found in app/Json.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in app/Json.php by phpcodesniffer

There are no issues that match your filters.

Category
Status