@@ -2,29 +2,29 @@ |
||
| 2 | 2 | /** |
| 3 | 3 | * @const DILMUN_BASE_DIR The base directory at which Dilmun resides |
| 4 | 4 | */ |
| 5 | -define('DILMUN_BASE_DIR', dirname(dirname(dirname(__FILE__))) . "/"); |
|
| 5 | +define('DILMUN_BASE_DIR', dirname(dirname(dirname(__FILE__)))."/"); |
|
| 6 | 6 | |
| 7 | 7 | /** |
| 8 | 8 | * @const DILMUN_SOURCE_DIR The source directory |
| 9 | 9 | */ |
| 10 | -define('DILMUN_SOURCE_DIR', DILMUN_BASE_DIR . "src/"); |
|
| 10 | +define('DILMUN_SOURCE_DIR', DILMUN_BASE_DIR."src/"); |
|
| 11 | 11 | |
| 12 | 12 | /** |
| 13 | 13 | * @const DILMUN_VENDOR_DIR The vendor directory |
| 14 | 14 | */ |
| 15 | -define('DILMUN_VENDOR_DIR', DILMUN_BASE_DIR . "vendor/"); |
|
| 15 | +define('DILMUN_VENDOR_DIR', DILMUN_BASE_DIR."vendor/"); |
|
| 16 | 16 | |
| 17 | 17 | /** |
| 18 | 18 | * @const DILMUN_LOGS_DIR The log directory |
| 19 | 19 | */ |
| 20 | -define('DILMUN_LOGS_DIR', DILMUN_BASE_DIR . "app/logs/"); |
|
| 20 | +define('DILMUN_LOGS_DIR', DILMUN_BASE_DIR."app/logs/"); |
|
| 21 | 21 | |
| 22 | 22 | /** |
| 23 | 23 | * @const DILMUN_CONFIG_DIR The configurations directory |
| 24 | 24 | */ |
| 25 | -define('DILMUN_CONFIG_DIR', DILMUN_BASE_DIR . "app/config/"); |
|
| 25 | +define('DILMUN_CONFIG_DIR', DILMUN_BASE_DIR."app/config/"); |
|
| 26 | 26 | |
| 27 | 27 | /** |
| 28 | 28 | * @const DILMUN_TEST_DIR The tests directory |
| 29 | 29 | */ |
| 30 | -define('DILMUN_TEST_DIR', DILMUN_BASE_DIR . "tests/"); |
|
| 30 | +define('DILMUN_TEST_DIR', DILMUN_BASE_DIR."tests/"); |
|
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | $full_file = ""; |
| 177 | 177 | |
| 178 | 178 | if (isset($this->file_path)) { |
| 179 | - $full_file = $this->file_path . DIRECTORY_SEPARATOR; |
|
| 179 | + $full_file = $this->file_path.DIRECTORY_SEPARATOR; |
|
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | $full_file .= $this->file_name; |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | |
| 231 | 231 | if ($locked) { |
| 232 | 232 | $now = date('Y-m-d H:i:s'); |
| 233 | - $this->file_pointer->fwrite("$now : $message" . "\r\n"); |
|
| 233 | + $this->file_pointer->fwrite("$now : $message"."\r\n"); |
|
| 234 | 234 | $this->file_pointer->flock(LOCK_UN); |
| 235 | 235 | |
| 236 | 236 | return true; |
@@ -218,7 +218,7 @@ |
||
| 218 | 218 | $replace = array(); |
| 219 | 219 | |
| 220 | 220 | foreach ($context as $key => $value) { |
| 221 | - $templated = "{" . $key . "}"; |
|
| 221 | + $templated = "{".$key."}"; |
|
| 222 | 222 | $replace[$templated] = $value; |
| 223 | 223 | } |
| 224 | 224 | |
@@ -4,8 +4,8 @@ |
||
| 4 | 4 | */ |
| 5 | 5 | |
| 6 | 6 | require "config/app_constants.php"; |
| 7 | -require DILMUN_VENDOR_DIR . "autoload.php"; |
|
| 8 | -require DILMUN_SOURCE_DIR . "Nabu/Autoloader.php"; |
|
| 7 | +require DILMUN_VENDOR_DIR."autoload.php"; |
|
| 8 | +require DILMUN_SOURCE_DIR."Nabu/Autoloader.php"; |
|
| 9 | 9 | |
| 10 | 10 | /** |
| 11 | 11 | * @todo Pull this out somehow so that logging on bootstrap is more abstract |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | */ |
| 24 | 24 | public function register() |
| 25 | 25 | { |
| 26 | - spl_autoload_register(array($this,"includeClass")); |
|
| 26 | + spl_autoload_register(array($this, "includeClass")); |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | /** |
@@ -41,10 +41,10 @@ discard block |
||
| 41 | 41 | $this->updateLog("info", "Preparing package {$package} for registration with path {$path}."); |
| 42 | 42 | |
| 43 | 43 | $package = trim($package, "\\"); |
| 44 | - $package = $package . "\\"; |
|
| 44 | + $package = $package."\\"; |
|
| 45 | 45 | |
| 46 | 46 | $path = rtrim($path, DIRECTORY_SEPARATOR); |
| 47 | - $path = $path . "/"; |
|
| 47 | + $path = $path."/"; |
|
| 48 | 48 | |
| 49 | 49 | $path_registered = $this->registrationExists($package, $path); |
| 50 | 50 | |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | $package_stack = array(); |
| 83 | 83 | |
| 84 | 84 | foreach ($class_bits as $bit) { |
| 85 | - $package = $package . $bit . "\\"; |
|
| 85 | + $package = $package.$bit."\\"; |
|
| 86 | 86 | |
| 87 | 87 | $package_registered = $this->packageRegistered($package); |
| 88 | 88 | |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | |
| 141 | 141 | foreach ($this->packages[$package_name] as $path) { |
| 142 | 142 | $converted_class = str_replace('\\', DIRECTORY_SEPARATOR, $class_name); |
| 143 | - $class_path = $path . $converted_class . ".php"; |
|
| 143 | + $class_path = $path.$converted_class.".php"; |
|
| 144 | 144 | |
| 145 | 145 | $this->updateLog("debug", "Class file path is {$class_path}"); |
| 146 | 146 | |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | $package_loaded = $this->loadPackage($package, $class_path); |
| 115 | 115 | |
| 116 | 116 | if ($package_loaded) { |
| 117 | - $this->updateLog("info", "Loaded {$class_path} using package {$package}"); |
|
| 117 | + $this->updateLog("info", "loaded {$class_path} using package {$package}"); |
|
| 118 | 118 | return true; |
| 119 | 119 | } |
| 120 | 120 | } |
@@ -163,9 +163,9 @@ discard block |
||
| 163 | 163 | $package_registered = array_key_exists($package, $this->packages); |
| 164 | 164 | |
| 165 | 165 | if ($package_registered) { |
| 166 | - $this->updateLog("info", "Package {$package} is registered"); |
|
| 166 | + $this->updateLog("info", "package {$package} is registered"); |
|
| 167 | 167 | } else { |
| 168 | - $this->updateLog("info", "Package {$package} is not registered"); |
|
| 168 | + $this->updateLog("info", "package {$package} is not registered"); |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | return $package_registered; |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | if ($path_registered !== false) { |
| 191 | 191 | $path_registered = true; |
| 192 | 192 | |
| 193 | - $this->updateLog("info", "Path {$path} already registered for package {$package}"); |
|
| 193 | + $this->updateLog("info", "path {$path} already registered for package {$package}"); |
|
| 194 | 194 | } |
| 195 | 195 | } else { |
| 196 | 196 | $path_registered = false; |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | private function requireFile($path) |
| 211 | 211 | { |
| 212 | 212 | if (file_exists($path)) { |
| 213 | - $this->updateLog("debug", "File {$path} exists; requiring file"); |
|
| 213 | + $this->updateLog("debug", "file {$path} exists; requiring file"); |
|
| 214 | 214 | |
| 215 | 215 | /** @noinspection PhpIncludeInspection */ |
| 216 | 216 | require $path; |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | |
| 220 | 220 | return true; |
| 221 | 221 | } else { |
| 222 | - $this->updateLog("debug", "File {$path} does not exist"); |
|
| 222 | + $this->updateLog("debug", "file {$path} does not exist"); |
|
| 223 | 223 | |
| 224 | 224 | return false; |
| 225 | 225 | } |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | } else { |
| 33 | 33 | $this->contents = false; |
| 34 | 34 | |
| 35 | - $this->updateLog("alert", "File {$contents} not found"); |
|
| 35 | + $this->updateLog("alert", "file {$contents} not found"); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | return $contents_exist; |
@@ -1,10 +1,8 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | namespace spec\Subreality\Dilmun\Anshar; |
| 3 | 3 | |
| 4 | -use Subreality\Dilmun\Anshar\HttpReader; |
|
| 5 | 4 | use PhpSpec\ObjectBehavior; |
| 6 | -use Prophecy\Argument; |
|
| 7 | -use Subreality\Dilmun\Nabu\Logger; |
|
| 5 | +use Subreality\Dilmun\Anshar\HttpReader; |
|
| 8 | 6 | |
| 9 | 7 | class HttpReaderSpec extends ObjectBehavior |
| 10 | 8 | { |
@@ -2,10 +2,10 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace spec\Subreality\Dilmun\Anshar\Http; |
| 4 | 4 | |
| 5 | +use PhpSpec\ObjectBehavior; |
|
| 5 | 6 | use Psr\Http\Message\StreamInterface; |
| 6 | 7 | use Psr\Http\Message\UriInterface; |
| 7 | 8 | use Subreality\Dilmun\Anshar\Http\Request; |
| 8 | -use PhpSpec\ObjectBehavior; |
|
| 9 | 9 | |
| 10 | 10 | /** |
| 11 | 11 | * Class RequestSpec |
@@ -455,7 +455,7 @@ |
||
| 455 | 455 | * @param \PhpSpec\Wrapper\Collaborator|StreamInterface $new_body |
| 456 | 456 | */ |
| 457 | 457 | function it_retains_its_body_when_returning_a_new_request_with_a_body(StreamInterface $old_body, |
| 458 | - StreamInterface $new_body) |
|
| 458 | + StreamInterface $new_body) |
|
| 459 | 459 | { |
| 460 | 460 | $old_body->getContents()->willReturn("I'm the original stream!"); |
| 461 | 461 | $new_body->getContents()->willReturn("I'm the new stream!"); |
@@ -702,7 +702,7 @@ discard block |
||
| 702 | 702 | |
| 703 | 703 | $uri->getHost()->willReturn($host); |
| 704 | 704 | |
| 705 | - $empty_host = $this->withHeader("host",""); |
|
| 705 | + $empty_host = $this->withHeader("host", ""); |
|
| 706 | 706 | |
| 707 | 707 | $request = $empty_host->withUri($uri, true); |
| 708 | 708 | |
@@ -723,7 +723,7 @@ discard block |
||
| 723 | 723 | { |
| 724 | 724 | $uri->getHost()->willReturn(null); |
| 725 | 725 | |
| 726 | - $empty_host = $this->withHeader("host",""); |
|
| 726 | + $empty_host = $this->withHeader("host", ""); |
|
| 727 | 727 | |
| 728 | 728 | $request = $empty_host->withUri($uri); |
| 729 | 729 | |
@@ -435,7 +435,7 @@ discard block |
||
| 435 | 435 | /** |
| 436 | 436 | * Return an instance with the specified message body. |
| 437 | 437 | * |
| 438 | - * @param \PhpSpec\Wrapper\Collaborator|StreamInterface $body |
|
| 438 | + * @param StreamInterface $body |
|
| 439 | 439 | */ |
| 440 | 440 | function it_returns_a_new_request_with_a_body(StreamInterface $body) |
| 441 | 441 | { |
@@ -451,8 +451,8 @@ discard block |
||
| 451 | 451 | * immutability of the message, and MUST return a new instance that has the |
| 452 | 452 | * new body stream. |
| 453 | 453 | * |
| 454 | - * @param \PhpSpec\Wrapper\Collaborator|StreamInterface $old_body |
|
| 455 | - * @param \PhpSpec\Wrapper\Collaborator|StreamInterface $new_body |
|
| 454 | + * @param StreamInterface $old_body |
|
| 455 | + * @param StreamInterface $new_body |
|
| 456 | 456 | */ |
| 457 | 457 | function it_retains_its_body_when_returning_a_new_request_with_a_body(StreamInterface $old_body, |
| 458 | 458 | StreamInterface $new_body) |
@@ -624,7 +624,7 @@ discard block |
||
| 624 | 624 | * This method MUST update the Host header of the returned request by |
| 625 | 625 | * default if the URI contains a host component. |
| 626 | 626 | * |
| 627 | - * @param \PhpSpec\Wrapper\Collaborator|UriInterface $uri |
|
| 627 | + * @param UriInterface $uri |
|
| 628 | 628 | */ |
| 629 | 629 | function it_returns_a_new_request_with_a_uri_with_host_replacement(UriInterface $uri) |
| 630 | 630 | { |
@@ -648,7 +648,7 @@ discard block |
||
| 648 | 648 | * - If a Host header is present and non-empty, this method MUST NOT update |
| 649 | 649 | * the Host header in the returned request. |
| 650 | 650 | * |
| 651 | - * @param \PhpSpec\Wrapper\Collaborator|UriInterface $uri |
|
| 651 | + * @param UriInterface $uri |
|
| 652 | 652 | */ |
| 653 | 653 | function it_returns_a_new_request_with_a_uri_without_host_replacement(UriInterface $uri) |
| 654 | 654 | { |
@@ -671,7 +671,7 @@ discard block |
||
| 671 | 671 | * a host component, this method MUST update the Host header in the returned |
| 672 | 672 | * request. |
| 673 | 673 | * |
| 674 | - * @param \PhpSpec\Wrapper\Collaborator|UriInterface $uri |
|
| 674 | + * @param UriInterface $uri |
|
| 675 | 675 | */ |
| 676 | 676 | function it_returns_a_new_request_with_a_host_when_no_host_set(UriInterface $uri) |
| 677 | 677 | { |
@@ -694,7 +694,7 @@ discard block |
||
| 694 | 694 | * a host component, this method MUST update the Host header in the returned |
| 695 | 695 | * request. |
| 696 | 696 | * |
| 697 | - * @param \PhpSpec\Wrapper\Collaborator|UriInterface $uri |
|
| 697 | + * @param UriInterface $uri |
|
| 698 | 698 | */ |
| 699 | 699 | function it_returns_a_new_request_with_a_host_when_empty_host_set(UriInterface $uri) |
| 700 | 700 | { |
@@ -717,7 +717,7 @@ discard block |
||
| 717 | 717 | * host component, this method MUST NOT update the Host header in the returned |
| 718 | 718 | * request. |
| 719 | 719 | * |
| 720 | - * @param \PhpSpec\Wrapper\Collaborator|UriInterface $uri |
|
| 720 | + * @param UriInterface $uri |
|
| 721 | 721 | */ |
| 722 | 722 | function it_preserves_its_original_empty_host_with_a_hostless_uri(UriInterface $uri) |
| 723 | 723 | { |
@@ -735,8 +735,8 @@ discard block |
||
| 735 | 735 | * immutability of the message, and MUST return an instance that has the |
| 736 | 736 | * new UriInterface instance. |
| 737 | 737 | * |
| 738 | - * @param \PhpSpec\Wrapper\Collaborator|UriInterface $old_uri |
|
| 739 | - * @param \PhpSpec\Wrapper\Collaborator|UriInterface $new_uri |
|
| 738 | + * @param UriInterface $old_uri |
|
| 739 | + * @param UriInterface $new_uri |
|
| 740 | 740 | */ |
| 741 | 741 | function it_retains_its_uri_when_returning_a_new_request_with_a_uri(UriInterface $old_uri, |
| 742 | 742 | UriInterface $new_uri) |
@@ -1,9 +1,8 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | namespace spec\Subreality\Dilmun\Anshar\Http; |
| 3 | 3 | |
| 4 | -use Subreality\Dilmun\Anshar\Http\Uri; |
|
| 5 | 4 | use PhpSpec\ObjectBehavior; |
| 6 | -use Prophecy\Argument; |
|
| 5 | +use Subreality\Dilmun\Anshar\Http\Uri; |
|
| 7 | 6 | |
| 8 | 7 | class UriSpec extends ObjectBehavior |
| 9 | 8 | { |