diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..8c408bc --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2012-2013 ThinFrame Project + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md index c05e91a..3f563f9 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ A collection of PHP classes that simplifies the work with the HTTP protocol. ##Installation -* via Composer: `"thinframe/http":"@stable"` +* via Composer: `"thinframe/http":"0.3.*"` ##Copyright diff --git a/composer.json b/composer.json index 21cea6b..872266a 100644 --- a/composer.json +++ b/composer.json @@ -13,14 +13,20 @@ "role": "Developer" } ], - "minimum-stability": "stable", + "minimum-stability": "dev", "require": { "php": ">=5.4.0", - "thinframe/foundation": "@stable" + "thinframe/foundation": "dev-develop" }, "autoload": { "psr-4": { "ThinFrame\\Http\\": "src/" } + }, + "extra": { + "branch-alias": { + "dev-master": "0.2-dev", + "dev-develop": "0.3-dev" + } } } diff --git a/composer.lock b/composer.lock index d091f92..c9fc0bb 100644 --- a/composer.lock +++ b/composer.lock @@ -3,20 +3,20 @@ "This file locks the dependencies of your project to a known state", "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file" ], - "hash": "558940a96774a055185fafb5527e702e", + "hash": "8b8322f1bf276d3555d0327042432aee", "packages": [ { "name": "danielstjules/stringy", - "version": "1.2.2", + "version": "1.4.0", "source": { "type": "git", "url": "https://github.com/danielstjules/Stringy.git", - "reference": "6ba29637b2b2bc8cfd735539c6f9716ae8957477" + "reference": "b990df3c6136509775e03a1f58cb658c5b11b682" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/danielstjules/Stringy/zipball/6ba29637b2b2bc8cfd735539c6f9716ae8957477", - "reference": "6ba29637b2b2bc8cfd735539c6f9716ae8957477", + "url": "https://api.github.com/repos/danielstjules/Stringy/zipball/b990df3c6136509775e03a1f58cb658c5b11b682", + "reference": "b990df3c6136509775e03a1f58cb658c5b11b682", "shasum": "" }, "require": { @@ -24,8 +24,8 @@ }, "type": "library", "autoload": { - "psr-0": { - "Stringy": "src/" + "psr-4": { + "Stringy\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -52,7 +52,7 @@ "utility", "utils" ], - "time": "2013-12-05 04:36:17" + "time": "2014-02-13 00:26:15" }, { "name": "phpcollection/phpcollection", @@ -155,30 +155,31 @@ }, { "name": "thinframe/foundation", - "version": "dev-master", + "version": "dev-develop", "source": { "type": "git", "url": "https://github.com/thinframe/foundation.git", - "reference": "9185ddd7c9ac915ca98005beb4916f3cc010dce8" + "reference": "48bf25639c672229498ce06ada3e45323f6f2c25" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thinframe/foundation/zipball/9185ddd7c9ac915ca98005beb4916f3cc010dce8", - "reference": "9185ddd7c9ac915ca98005beb4916f3cc010dce8", + "url": "https://api.github.com/repos/thinframe/foundation/zipball/48bf25639c672229498ce06ada3e45323f6f2c25", + "reference": "48bf25639c672229498ce06ada3e45323f6f2c25", "shasum": "" }, "require": { - "danielstjules/stringy": "1.2.*", + "danielstjules/stringy": "1.4.0", "php": ">=5.4.0", - "phpcollection/phpcollection": "0.3.*" + "phpcollection/phpcollection": "0.3.1" }, "require-dev": { - "phpunit/phpunit": "3.7.*" + "phpunit/phpunit": "3.7.32" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "0.2-dev" + "dev-master": "0.2-dev", + "dev-develop": "0.3-dev" } }, "autoload": { @@ -204,7 +205,7 @@ "foundation", "thinframe" ], - "time": "2014-01-22 18:16:30" + "time": "2014-03-09 16:08:12" } ], "packages-dev": [ diff --git a/src/Constants/Method.php b/src/Constant/Method.php similarity index 68% rename from src/Constants/Method.php rename to src/Constant/Method.php index 73bbc6a..cbc72ec 100644 --- a/src/Constants/Method.php +++ b/src/Constant/Method.php @@ -1,18 +1,16 @@ + * @author Sorin Badea * @license MIT license (see the license file in the root directory) */ -namespace ThinFrame\Http\Constants; +namespace ThinFrame\Http\Constant; -use ThinFrame\Foundation\DataTypes\AbstractEnum; +use ThinFrame\Foundation\DataType\AbstractEnum; /** - * Class Method + * Method * * @package ThinFrame\Http\Constants * @since 0.2 @@ -27,4 +25,4 @@ final class Method extends AbstractEnum const PUT = 'put'; const DELETE = 'delete'; const PATCH = 'patch'; -} \ No newline at end of file +} diff --git a/src/Constants/RequestHeader.php b/src/Constant/RequestHeader.php similarity index 92% rename from src/Constants/RequestHeader.php rename to src/Constant/RequestHeader.php index 9e60beb..a072896 100644 --- a/src/Constants/RequestHeader.php +++ b/src/Constant/RequestHeader.php @@ -1,16 +1,14 @@ + * @author Sorin Badea * @license MIT license (see the license file in the root directory) */ -namespace ThinFrame\Http\Constants; +namespace ThinFrame\Http\Constant; /** - * Class RequestHeader + * RequestHeader * * @package ThinFrame\Http\Constants * @since 0.2 @@ -54,4 +52,4 @@ final class RequestHeader const DNT = 'DNT'; const X_FORWARDED_FOR = 'X-Forwarded-For'; const X_FORWARDED_PROTO = 'X-Forwarded-Proto'; -} \ No newline at end of file +} diff --git a/src/Constants/ResponseHeader.php b/src/Constant/ResponseHeader.php similarity index 93% rename from src/Constants/ResponseHeader.php rename to src/Constant/ResponseHeader.php index 3c7d624..764c084 100644 --- a/src/Constants/ResponseHeader.php +++ b/src/Constant/ResponseHeader.php @@ -1,16 +1,14 @@ + * @author Sorin Badea * @license MIT license (see the license file in the root directory) */ -namespace ThinFrame\Http\Constants; +namespace ThinFrame\Http\Constant; /** - * Class ResponseHeader + * ResponseHeader * * @package ThinFrame\Http\Constants * @since 0.2 @@ -53,4 +51,4 @@ final class ResponseHeader const VIA = 'Via'; const WARNING = 'Warning'; const WWW_AUTHENTICATE = 'WWW-Authenticate'; -} \ No newline at end of file +} diff --git a/src/Constants/StatusCode.php b/src/Constant/StatusCode.php similarity index 94% rename from src/Constants/StatusCode.php rename to src/Constant/StatusCode.php index 9ffd0dd..7ddd121 100644 --- a/src/Constants/StatusCode.php +++ b/src/Constant/StatusCode.php @@ -1,19 +1,17 @@ + * @author Sorin Badea * @license MIT license (see the license file in the root directory) */ -namespace ThinFrame\Http\Constants; +namespace ThinFrame\Http\Constant; -use ThinFrame\Foundation\DataTypes\AbstractEnum; -use ThinFrame\Foundation\Exceptions\InvalidArgumentException; +use ThinFrame\Foundation\DataType\AbstractEnum; +use ThinFrame\Foundation\Exception\InvalidArgumentException; /** - * Class StatusCode + * StatusCode * * @package ThinFrame\Http\Constants * @since 0.2 @@ -123,7 +121,7 @@ public function getMessage($protocol = "HTTP/1.1") * @param string $protocol * * @return string - * @throws \ThinFrame\Foundation\Exceptions\InvalidArgumentException + * @throws \ThinFrame\Foundation\Exception\InvalidArgumentException */ public static function getMessageFor($statusCode, $protocol = "HTTP/1.1") { diff --git a/src/Foundation/AbstractRequest.php b/src/Foundation/AbstractRequest.php index c80bf2e..50d958c 100644 --- a/src/Foundation/AbstractRequest.php +++ b/src/Foundation/AbstractRequest.php @@ -1,19 +1,17 @@ + * @author Sorin Badea * @license MIT license (see the license file in the root directory) */ namespace ThinFrame\Http\Foundation; use PhpCollection\Map; -use ThinFrame\Http\Constants\Method; +use ThinFrame\Http\Constant\Method; /** - * Class AbstractRequest + * AbstractRequest * * @package ThinFrame\Http\Foundation * @since 0.2 @@ -283,13 +281,13 @@ public function getRemoteIp() /** * Set remote ip address * - * @param string $ip + * @param string $ipAddress * * @return $this */ - public function setRemoteIp($ip) + public function setRemoteIp($ipAddress) { - $this->remoteIp = $ip; + $this->remoteIp = $ipAddress; return $this; } diff --git a/src/Foundation/AbstractResponse.php b/src/Foundation/AbstractResponse.php index 894798a..8847b78 100644 --- a/src/Foundation/AbstractResponse.php +++ b/src/Foundation/AbstractResponse.php @@ -1,19 +1,17 @@ + * @author Sorin Badea * @license MIT license (see the license file in the root directory) */ namespace ThinFrame\Http\Foundation; use PhpCollection\Map; -use ThinFrame\Http\Constants\StatusCode; +use ThinFrame\Http\Constant\StatusCode; /** - * Class AbstractResponse + * AbstractResponse * * @package ThinFrame\Http\Foundation * @since 0.2 diff --git a/src/Foundation/CookieInterface.php b/src/Foundation/CookieInterface.php index 5581ea8..152b1c0 100644 --- a/src/Foundation/CookieInterface.php +++ b/src/Foundation/CookieInterface.php @@ -1,16 +1,14 @@ + * @author Sorin Badea * @license MIT license (see the license file in the root directory) */ namespace ThinFrame\Http\Foundation; /** - * Class CookieInterface + * CookieInterface * * @package ThinFrame\Http\Foundation * @since 0.2 diff --git a/src/Foundation/RequestInterface.php b/src/Foundation/RequestInterface.php index c0578ac..5b6def0 100644 --- a/src/Foundation/RequestInterface.php +++ b/src/Foundation/RequestInterface.php @@ -1,19 +1,17 @@ + * @author Sorin Badea * @license MIT license (see the license file in the root directory) */ namespace ThinFrame\Http\Foundation; use PhpCollection\Map; -use ThinFrame\Http\Constants\Method; +use ThinFrame\Http\Constant\Method; /** - * Class RequestInterface + * RequestInterface * * @package ThinFrame\Http\Foundation * @since 0.2 @@ -159,9 +157,9 @@ public function getRemoteIp(); /** * Set remote ip address * - * @param string $ip + * @param string $ipAddress * * @return $this */ - public function setRemoteIp($ip); + public function setRemoteIp($ipAddress); } diff --git a/src/Foundation/ResponseInterface.php b/src/Foundation/ResponseInterface.php index 199bd93..3268fe5 100644 --- a/src/Foundation/ResponseInterface.php +++ b/src/Foundation/ResponseInterface.php @@ -1,19 +1,17 @@ + * @author Sorin Badea * @license MIT license (see the license file in the root directory) */ namespace ThinFrame\Http\Foundation; use PhpCollection\Map; -use ThinFrame\Http\Constants\StatusCode; +use ThinFrame\Http\Constant\StatusCode; /** - * Class ResponseInterface + * ResponseInterface * * @package ThinFrame\Http\Foundation * @since 0.2 diff --git a/src/Utils/BodyParser.php b/src/Util/BodyParser.php similarity index 94% rename from src/Utils/BodyParser.php rename to src/Util/BodyParser.php index 27b8640..efcc84a 100644 --- a/src/Utils/BodyParser.php +++ b/src/Util/BodyParser.php @@ -1,16 +1,14 @@ + * @author Sorin Badea * @license MIT license (see the license file in the root directory) */ -namespace ThinFrame\Http\Utils; +namespace ThinFrame\Http\Util; /** - * Class BodyParser - parse a raw http body + * BodyParser - parse a raw http body * * @package ThinFrame\Http\Utils * @since 0.2 @@ -136,9 +134,8 @@ private function parseBounderedBody() */ private function getBoundaryIdentifier() { - $startPosition = strpos($this->headers['Content-Type'], self::BOUNDARY_IDENTIFIER) + strlen( - self::BOUNDARY_IDENTIFIER - ); + $startPosition = strpos($this->headers['Content-Type'], self::BOUNDARY_IDENTIFIER) + + strlen(self::BOUNDARY_IDENTIFIER); return substr($this->headers['Content-Type'], $startPosition); } diff --git a/src/Utils/MimeTypeGuesser.php b/src/Util/MimeTypeGuesser.php similarity index 99% rename from src/Utils/MimeTypeGuesser.php rename to src/Util/MimeTypeGuesser.php index 0d8b5cd..407c03f 100644 --- a/src/Utils/MimeTypeGuesser.php +++ b/src/Util/MimeTypeGuesser.php @@ -1,16 +1,14 @@ + * @author Sorin Badea * @license MIT license (see the license file in the root directory) */ -namespace ThinFrame\Http\Utils; +namespace ThinFrame\Http\Util; /** - * Class MimeTypeGuesser + * MimeTypeGuesser * * @package ThinFrame\Http\Utils * @since 0.2