src/Loaders/ProposedOkFilenameLoader.php
/**
     * Returns the match with the passed name.
     *
     * @param array $keys The keys of the match to return
     *
     * @return string|null The match itself
     */
Returns the match with the passed name.
@param array $keys The keys of the match to return

@return string|null The match itself
Returns the match with the passed name . @param array $keys The keys of the match to return @return string|null The match itself
protected function proposedOkFilenamesByKeys(array $keys) : array
    {
        $result = array();
        $matches = $this->getLoader()->getMatches();
        foreach ($matches as $i => $match) {
            $elements = array();
            foreach ($keys as $key) {
                if (array_key_exists($key, $match)) {
                    $elements[$i][] = $match[$key];
                }
            }
            foreach ($elements as $element) {
                $sourceDir = dirname($csvPath = $match[0]);
                $okFilename = implode($this->getElementSeparator(), $element);
                $okPath = sprintf('%s/%s.%s', $sourceDir, $okFilename, $this->getOkFileSuffix());
                $result[$okPath][] = basename($csvPath);
            }
        }
        return $result;
    }
protected function proposedOkFilenamesByKeys ( array $ keys ) : array { $ result = array ( ) ; $ matches = $ this -> getLoader ( ) -> getMatches ( ) ; foreach ( $ matches as $ i => $ match ) { $ elements = array ( ) ; foreach ( $ keys as $ key ) { if ( array_key_exists ( $ key , $ match ) ) { $ elements [ $ i ] [ ] = $ match [ $ key ] ; } } foreach ( $ elements as $ element ) { $ sourceDir = dirname ( $ csvPath = $ match [ 0 ] ) ; $ okFilename = implode ( $ this -> getElementSeparator ( ) , $ element ) ; $ okPath = sprintf ( '%s/%s.%s' , $ sourceDir , $ okFilename , $ this -> getOkFileSuffix ( ) ) ; $ result [ $ okPath ] [ ] = basename ( $ csvPath ) ; } } return $ result ; }
Returns the match with the passed name.
Returns the match with the passed name .
// intialize the array for the .OK filename => .CSV filenames // load the matches from the preg match filesystem loader // process the matches // initialize the array for the values of the match elements // load the values from the matches // use the values to create the proposed .OK filenames // load the source directory // create the filename by concatenating the element values // create the path to the .OK file // register the proposed .OK file in the array // return the array with the result