You are here

protected function PHPUnit_Framework_Constraint_StringMatches::createPatternFromFormat in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/phpunit/phpunit/src/Framework/Constraint/StringMatches.php \PHPUnit_Framework_Constraint_StringMatches::createPatternFromFormat()
2 calls to PHPUnit_Framework_Constraint_StringMatches::createPatternFromFormat()
PHPUnit_Framework_Constraint_StringMatches::additionalFailureDescription in vendor/phpunit/phpunit/src/Framework/Constraint/StringMatches.php
Return additional failure description where needed
PHPUnit_Framework_Constraint_StringMatches::__construct in vendor/phpunit/phpunit/src/Framework/Constraint/StringMatches.php

File

vendor/phpunit/phpunit/src/Framework/Constraint/StringMatches.php, line 67

Class

PHPUnit_Framework_Constraint_StringMatches
...

Code

protected function createPatternFromFormat($string) {
  $string = str_replace(array(
    '%e',
    '%s',
    '%S',
    '%a',
    '%A',
    '%w',
    '%i',
    '%d',
    '%x',
    '%f',
    '%c',
  ), array(
    '\\' . DIRECTORY_SEPARATOR,
    '[^\\r\\n]+',
    '[^\\r\\n]*',
    '.+',
    '.*',
    '\\s*',
    '[+-]?\\d+',
    '\\d+',
    '[0-9a-fA-F]+',
    '[+-]?\\.?\\d+\\.?\\d*(?:[Ee][+-]?\\d+)?',
    '.',
  ), preg_quote($string, '/'));
  return '/^' . $string . '$/s';
}