示例#1
0
文件: Index.php 项目: rzajac/schema
 /**
  * Returns true if line is definition of one of the indexes.
  *
  * @param string $line The line from CREATE STATEMENT.
  *
  * @return bool
  */
 public static function isIndexDef($line)
 {
     if (Str::startsWith($line, 'PRIMARY KEY')) {
         return true;
     }
     if (Str::startsWith($line, 'UNIQUE KEY')) {
         return true;
     }
     if (Str::startsWith($line, 'KEY')) {
         return true;
     }
     return false;
 }
示例#2
0
 /**
  * @dataProvider startsWithProvider
  *
  * @covers ::startsWith
  *
  * @param string $str
  * @param string $needle
  * @param bool   $expected
  */
 public function test_startsWith($str, $needle, $expected)
 {
     // When
     $got = Str::startsWith($str, $needle);
     // Then
     $this->assertSame($expected, $got);
 }
示例#3
0
 /**
  * Returns true if line is definition of one of the index constraints.
  *
  * @param string $line The line from CREATE STATEMENT.
  *
  * @return bool
  */
 public static function isConstraintDef($line)
 {
     if (Str::startsWith($line, 'CONSTRAINT')) {
         return true;
     }
     return false;
 }