/** * Start the bootstrapping process * @return boolean */ private function Bootstrap() { if (!empty($this->dir)) { $files = scandir($this->dir, SCANDIR_SORT_ASCENDING); $units = array(); foreach ($files as $key => $file) { if (\BTRString::EndsWith($file, ".php")) { $path = $this->dir . "{$file}"; include $path; $units[] = $path; } } foreach ($units as $value) { $name = basename($value, ".php"); $unit = new $name(); $this->AddUnit($unit); } return true; } else { return false; } }
public function testEndsWithFalse3() { $got = \BTRString::EndsWith("hallo", "ha"); $this->assertFalse($got); }
/** * Ends a value in the array with the given needle? * @param array $haystack The haystack to search in * @param string $needle the needle to find * @param bool $ignorecase should the function work case insensitive? * @return boolean */ static function EndsWith($haystack, $needle, $ignorecase = false) { if (empty($haystack) || empty($needle) || !is_string($needle)) { return false; } foreach ($haystack as $value) { if (is_array($value) || is_object($value)) { $sub = \BTRArray::EndsWith($value, $needle, $ignorecase); } else { $sub = \BTRString::EndsWith($value, $needle, $ignorecase); } if ($sub === true) { return true; } } return false; }