Code Duplication    Length = 18-18 lines in 2 locations

class/utility.php 1 location

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

include/functions.php 1 location

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