Code Duplication    Length = 18-18 lines in 2 locations

class/Utility.php 1 location

@@ 430-447 (lines=18) @@
427
         * @param bool $isArray
428
         * @return array|null
429
         */
430
        public static function planetGetCookie($name, $isArray = false)
431
        {
432
            $value = isset($_COOKIE[$GLOBALS['VAR_PREFIX'] . $name]) ? $_COOKIE[$GLOBALS['VAR_PREFIX'] . $name] : null;
433
            if ($isArray) {
434
                $_value = $value ? explode(',', $value) : [];
435
                $value  = [];
436
                if (count($_value) > 0) {
437
                    foreach ($_value as $string) {
438
                        $key         = substr($string, 0, strpos($string, '|'));
439
                        $val         = substr($string, strpos($string, '|') + 1);
440
                        $value[$key] = $val;
441
                    }
442
                }
443
                unset($_value);
444
            }
445
446
            return $value;
447
        }
448
449
        /**
450
         * Function to filter text

include/functions.php 1 location

@@ 420-437 (lines=18) @@
417
     * @param bool $isArray
418
     * @return array|null
419
     */
420
    function planetGetCookie($name, $isArray = false)
421
    {
422
        $value = isset($_COOKIE[$GLOBALS['VAR_PREFIX'] . $name]) ? $_COOKIE[$GLOBALS['VAR_PREFIX'] . $name] : null;
423
        if ($isArray) {
424
            $_value = $value ? explode(',', $value) : [];
425
            $value  = [];
426
            if (count($_value) > 0) {
427
                foreach ($_value as $string) {
428
                    $key         = substr($string, 0, strpos($string, '|'));
429
                    $val         = substr($string, strpos($string, '|') + 1);
430
                    $value[$key] = $val;
431
                }
432
            }
433
            unset($_value);
434
        }
435
436
        return $value;
437
    }
438
439
    /**
440
     * Function to filter text