src/CurrencyPair.php
public static function createFromString(string $string): CurrencyPairContract
    {
        $matches = [];
        if (!preg_match('#^([A-Z0-9]{3,})\/([A-Z0-9]{3,})$#', $string, $matches)) {
            throw new \InvalidArgumentException('The currency pair must be in the form "EUR/USD".');
        }

        $parts = explode('/', $string);

        return new self($parts[0], $parts[1]);
    }
public static function createFromString(string $string): CurrencyPairContract
    {
        $matches = [];
        if (!preg_match('#^([A-Z0-9]{3,})\/([A-Z0-9]{3,})$#', $string, $matches)) {
            throw new \InvalidArgumentException('The currency pair must be in the form "EUR/USD".');
        }

        $parts = explode('/', $string);

        return new self($parts[0], $parts[1]);
    }
public static function createFromString ( string $ string ) : CurrencyPairContract { $ matches = [ ] ; if ( ! preg_match ( '#^([A-Z0-9]{3,})\/([A-Z0-9]{3,})$#' , $ string , $ matches ) ) { throw new \ InvalidArgumentException ( 'The currency pair must be in the form "EUR/USD".' ) ; } $ parts = explode ( '/' , $ string ) ; return new self ( $ parts [ 0 ] , $ parts [ 1 ] ) ; }
Creates a currency pair from a string.

@param string $string A string in the form EUR/USD

@throws \InvalidArgumentException

@return CurrencyPairContract
Creates a currency pair from a string .