startsWith() публичный статический Метод

Assert that string starts with a sequence of chars.
public static startsWith ( mixed $string, string $needle, string | null $message = null, string | null $propertyPath = null, string $encoding = 'utf8' ) : boolean
$string mixed
$needle string
$message string | null
$propertyPath string | null
$encoding string
Результат boolean
 private function setType($type)
 {
     Assertion::string($type, 'Token type should be a string');
     Assertion::startsWith($type, 'T_', 'Token type should start with T_');
     Assertion::true(defined($type), 'Token type should be the name of a defined constant');
     $this->type = $type;
     $this->code = constant($type);
 }
Пример #2
0
 public function testValidStartsWith()
 {
     Assertion::startsWith("foo", "foo");
     Assertion::startsWith("foo", "fo");
     Assertion::startsWith("foo", "f");
     Assertion::startsWith("址foo", "址");
 }
 /**
  * @Then the log messages should be shown
  */
 public function theLogMessagesShouldBeShown()
 {
     list($line0, $line1) = $this->data['output'];
     Assertion::startsWith($line0, 'purging database');
     Assertion::endsWith($line1, RoleFixture::class);
 }