protected function performConfig(array &$array, $option)
    {
        // Allow for the option to be a pipe delimited list
        foreach (explode('|', $option) as $action) {
            // Check to see if there are options on the action
            $action = explode(':', $action);

            // Perform the action based on the config
            switch (current($action)) {

                // Shuffle the array (looses keys)
                case 'randomize':
                    shuffle($array);
                    break;

                // Limit the number returned
                case 'limit':
                    if (isset($action[1])) {
                        $array = $this->arrayLimit($array, $action[1]);
                    }
                    break;

                // Picks just the first one
                case 'first':
                    if (count($array) > 0) {
                        $array = current($array);
                    }
                    break;

                // Only return the 'per page' associated with a specific page_id
                case 'page_id':
                    if (isset($action[1])) {
                        $array = $this->arrayPage($array, $action[1]);
                    }
                    break;

                // Reorder array by an array key
                case 'order':
                    if (isset($action[1])) {
                        $array = $this->arrayOrder($array, $action[1]);
                    }
                    break;

                // Parse out YouTube ID from link field
                case 'youtube':
                    $array = $this->parseYouTubeID($array);
                    break;
            }
        }

        return $array;
    }
protected function performConfig(array &$array, $option)
    {
        // Allow for the option to be a pipe delimited list
        foreach (explode('|', $option) as $action) {
            // Check to see if there are options on the action
            $action = explode(':', $action);

            // Perform the action based on the config
            switch (current($action)) {

                // Shuffle the array (looses keys)
                case 'randomize':
                    shuffle($array);
                    break;

                // Limit the number returned
                case 'limit':
                    if (isset($action[1])) {
                        $array = $this->arrayLimit($array, $action[1]);
                    }
                    break;

                // Picks just the first one
                case 'first':
                    if (count($array) > 0) {
                        $array = current($array);
                    }
                    break;

                // Only return the 'per page' associated with a specific page_id
                case 'page_id':
                    if (isset($action[1])) {
                        $array = $this->arrayPage($array, $action[1]);
                    }
                    break;

                // Reorder array by an array key
                case 'order':
                    if (isset($action[1])) {
                        $array = $this->arrayOrder($array, $action[1]);
                    }
                    break;

                // Parse out YouTube ID from link field
                case 'youtube':
                    $array = $this->parseYouTubeID($array);
                    break;
            }
        }

        return $array;
    }
protected function performConfig ( array & $ array , $ option ) { // Allow for the option to be a pipe delimited list foreach ( explode ( '|' , $ option ) as $ action ) { // Check to see if there are options on the action $ action = explode ( ':' , $ action ) ; // Perform the action based on the config switch ( current ( $ action ) ) { // Shuffle the array (looses keys) case 'randomize' : shuffle ( $ array ) ; break ; // Limit the number returned case 'limit' : if ( isset ( $ action [ 1 ] ) ) { $ array = $ this -> arrayLimit ( $ array , $ action [ 1 ] ) ; } break ; // Picks just the first one case 'first' : if ( count ( $ array ) > 0 ) { $ array = current ( $ array ) ; } break ; // Only return the 'per page' associated with a specific page_id case 'page_id' : if ( isset ( $ action [ 1 ] ) ) { $ array = $ this -> arrayPage ( $ array , $ action [ 1 ] ) ; } break ; // Reorder array by an array key case 'order' : if ( isset ( $ action [ 1 ] ) ) { $ array = $ this -> arrayOrder ( $ array , $ action [ 1 ] ) ; } break ; // Parse out YouTube ID from link field case 'youtube' : $ array = $ this -> parseYouTubeID ( $ array ) ; break ; } } return $ array ; }
Take a promotion group and perform an action on it

@param array $array
@param string $option
@return array|mixed
Take a promotion group and perform an action on it