Mistři v programování na #hovnokod

PHP #805

https://github.com/juriya/juriya/blob/develop/src/Juriya/Collection.php#L268

    /**
     * Handle collection setter
     *
     * @param mixed Collection key
     * @param mixed Collection values
     * @return void
     */
    public function set($key = '', $value = NULL)
    {
        $path = explode('.', $key);
        $array = array();

        if (is_array($path)) {
            // Accept up to 5 level array
            switch (count($path)) {
                case 1:
                    $this->collections[$path[0]] = $value;
                    break;
                
                case 2:
                    $this->collections[$path[0]][$path[1]] = $value;
                    break;
                
                case 3:
                    $this->collections[$path[0]][$path[1]][$path[2]] = $value;
                    break;
                
                case 4:
                    $this->collections[$path[0]][$path[1]][$path[2]][$path[3]] = $value;
                    break;
                
                case 5:
                    $this->collections[$path[0]][$path[1]][$path[2]][$path[3]][$path[4]] = $value;
                    break;
                
                // @codeCoverageIgnoreStart
                default:
                    $this->collections = $value;
                    break;
                // @codeCoverageIgnoreEnd
            }
        }
    }

Anonymous,