protected static function toCanonicalForm($config, $key = 'operand')
    {
        if (!is_array($config)) {
            return array($key => $config);

        } elseif (array_key_exists('operator', $config)
                  || array_key_exists('operand', $config)
        ) {
            return $config;

        } elseif (1 == count($config)) {
            return array($key => end($config));

        } else {
            return array('operator' => reset($config), 'operand' => end($config));
        }
    }
protected static function toCanonicalForm($config, $key = 'operand')
    {
        if (!is_array($config)) {
            return array($key => $config);

        } elseif (array_key_exists('operator', $config)
                  || array_key_exists('operand', $config)
        ) {
            return $config;

        } elseif (1 == count($config)) {
            return array($key => end($config));

        } else {
            return array('operator' => reset($config), 'operand' => end($config));
        }
    }
protected static function toCanonicalForm ( $ config , $ key = 'operand' ) { if ( ! is_array ( $ config ) ) { return array ( $ key => $ config ) ; } elseif ( array_key_exists ( 'operator' , $ config ) || array_key_exists ( 'operand' , $ config ) ) { return $ config ; } elseif ( 1 == count ( $ config ) ) { return array ( $ key => end ( $ config ) ) ; } else { return array ( 'operator' => reset ( $ config ) , 'operand' => end ( $ config ) ) ; } }
Converts configuration data to a canonical associative array form

@param    mixed   Configuration data
@param    string  Array key to assign $config to if it is scalar
@return   array   Associative array that may contain 'operand' and 'operator' keys
Converts configuration data to a canonical associative array form