Entity/EntityService.php
private function extractValues(array $values, $prefix, $removePrefixFromKeys = true)
    {
        if (empty($values)) {
            return array();
        }

        $validKeys = array_filter(array_keys($values), function($name) use ($prefix) {
            return (0 === strpos($name, $prefix));
        });

        $results = array_intersect_key($values, array_flip($validKeys));
        if (!$removePrefixFromKeys) {
            return $results;
        }

        return array_combine(
            array_map(function($key) use ($prefix) {
                return str_replace($prefix, '', $key);
            }, array_keys($results)), $results
        );
    }
private function extractValues(array $values, $prefix, $removePrefixFromKeys = true)
    {
        if (empty($values)) {
            return array();
        }

        $validKeys = array_filter(array_keys($values), function($name) use ($prefix) {
            return (0 === strpos($name, $prefix));
        });

        $results = array_intersect_key($values, array_flip($validKeys));
        if (!$removePrefixFromKeys) {
            return $results;
        }

        return array_combine(
            array_map(function($key) use ($prefix) {
                return str_replace($prefix, '', $key);
            }, array_keys($results)), $results
        );
    }
private function extractValues ( array $ values , $ prefix , $ removePrefixFromKeys = true ) { if ( empty ( $ values ) ) { return array ( ) ; } $ validKeys = array_filter ( array_keys ( $ values ) , function ( $ name ) use ( $ prefix ) { return ( 0 === strpos ( $ name , $ prefix ) ) ; } ) ; $ results = array_intersect_key ( $ values , array_flip ( $ validKeys ) ) ; if ( ! $ removePrefixFromKeys ) { return $ results ; } return array_combine ( array_map ( function ( $ key ) use ( $ prefix ) { return str_replace ( $ prefix , '' , $ key ) ; } , array_keys ( $ results ) ) , $ results ) ; }
Returns all the key-value pairs from the array whose key has the specified prefix.

@param array $values
@param string $prefix
@param bool $removePrefixFromKeys
@return array
Returns all the key - value pairs from the array whose key has the specified prefix .