Skip to content

Commit

Permalink
Merge branch 'niden-T13907-collection-psr7' into 4.0.x
Browse files Browse the repository at this point in the history
* niden-T13907-collection-psr7:
  [#13907] - Changing internal to private to check the Windows build
  [#13907] - Added more tests initializing headers with a collection
  [#13907] - Added the ability to pass a collection object and array
  [#13907] - Added Collection for headers and attributes
  [#13907] - Refactoring response
  [#13907] - Incorporated Collection to the Request
  [4.0.x] - Changed the constructor to use memory instead of temp
  [4.0.x] - Corrected return value for get
  [#13907] - Added the ability to pass a collection object and array
  [#13907] - Added Collection for headers and attributes
  [#13907] - Refactoring response
  [#13907] - Incorporated Collection to the Request
  [4.0.x] - Changed the constructor to use memory instead of temp
  [4.0.x] - Corrected return value for get
  • Loading branch information
niden committed Mar 24, 2019
2 parents b7144e7 + c5f8b49 commit 5af4ca4
Show file tree
Hide file tree
Showing 8 changed files with 364 additions and 379 deletions.
1 change: 1 addition & 0 deletions CHANGELOG-4.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ The implementation offers PSR-7/PSR-17 compatible components in a different name
- `Phalcon\Helper\Number`
[#13889](https://github.com/phalcon/cphalcon/pull/13889)
- Added `Phalcon\Collection`, an object implementing `ArrayAccess`, `Countable`, `IteratorAggregate`, `JsonSerializable`, `Serializable`, offering an easy way to handle collections of data such as arrays, superglobals etc. [#13886](https://github.com/phalcon/cphalcon/issues/13886)
- Added `Phalcon\Collection`, in `Phalcon\Http\Message\Request` and `Phalcon\Http\Message\ServerRequest` to handle the headers [#13907](https://github.com/phalcon/cphalcon/issues/13907)

## Fixed
- Fixed `Phalcon\Image\Adapter\Imagick::_watermark`, `setImageAlpha()` fills the alpha channel with black before execution (replaced by `evaluateImage()`). Improved imagick compatibility. [#13911](https://github.com/phalcon/cphalcon/pull/13911)
Expand Down
10 changes: 5 additions & 5 deletions phalcon/collection.zep
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,12 @@ class Collection implements \ArrayAccess, \Countable, \IteratorAggregate, \JsonS
/**
* Get the element from the collection
*/
public function get(string! element, var defaultValue = null, bool insensitive = true) -> var | bool
public function get(string! element, var defaultValue = null, bool insensitive = true) -> var
{
var value;

if likely insensitive {
let element = strtolower(element);
let element = element->lower();
}

if likely fetch value, this->lowerKeys[element] {
Expand All @@ -120,7 +120,7 @@ class Collection implements \ArrayAccess, \Countable, \IteratorAggregate, \JsonS
public function has(string! element, bool insensitive = true) -> bool
{
if likely insensitive {
let element = strtolower(element);
let element = element->lower();
}

return isset this->lowerKeys[element];
Expand Down Expand Up @@ -209,7 +209,7 @@ class Collection implements \ArrayAccess, \Countable, \IteratorAggregate, \JsonS

if this->has(element) {
if likely insensitive {
let element = strtolower(element);
let element = element->lower();
}

let value = lowerKeys[element];
Expand Down Expand Up @@ -239,7 +239,7 @@ class Collection implements \ArrayAccess, \Countable, \IteratorAggregate, \JsonS
{
var key;

let key = strtolower(element);
let key = element->lower();

let this->data[element] = value,
this->lowerKeys[key] = element;
Expand Down
Loading

0 comments on commit 5af4ca4

Please sign in to comment.