/** * @param LouisCRUD $crud * @param string $name * @param string $dataType */ public function __construct($crud, $name, $dataType) { $this->crud = $crud; $this->name = $name; $this->displayName = Util::displayName($name); $this->dataType = $dataType; if (LouisString::contains($dataType, "varchar")) { $this->fieldType = new TextField(); } else { if (LouisString::contains($dataType, "int")) { $this->fieldType = new IntegerType(); } else { if (LouisString::contains($dataType, "text")) { $this->fieldType = new TextArea(); } else { $this->fieldType = new TextField(); } } } $this->fieldType->setField($this); }
public function testContains() { $this->assertEquals(true, \LouisLam\LouisString::contains("Hello World", "Hello")); }