Skip to content
This repository has been archived by the owner on Jan 31, 2020. It is now read-only.

Minimize duplicated code on ArrayUtils #62

Closed
GeeH opened this issue Jun 28, 2016 · 0 comments
Closed

Minimize duplicated code on ArrayUtils #62

GeeH opened this issue Jun 28, 2016 · 0 comments

Comments

@GeeH
Copy link
Contributor

GeeH commented Jun 28, 2016

This issue has been moved from the zendframework repository as part of the bug migration program as outlined here - http://framework.zend.com/blog/2016-04-11-issue-closures.html


Original Issue: https://api.github.com/repos/zendframework/zendframework/issues/7405
User: @malukenho
Created On: 2015-04-02T12:17:39Z
Updated At: 2015-04-15T07:44:16Z
Body


Comment

User: @Ocramius
Created On: 2015-04-02T14:46:53Z
Updated At: 2015-04-02T14:46:53Z
Body
Closing as inapplicable


Comment

User: @malukenho
Created On: 2015-04-02T14:48:30Z
Updated At: 2015-04-02T14:48:30Z
Body
@Ocramius if I use $value instanceof Traversable || is_array($value) instead?


Comment

User: @Maks3w
Created On: 2015-04-02T15:44:29Z
Updated At: 2015-04-02T15:44:29Z
Body
Some parts of the code are written by this way just for make the code more legible.

May this could be more close to both purposes:

if (
  $value instanceof Traversable
  || is_array($value)
) {
  // ...
}

Comment

User: @Ocramius
Created On: 2015-04-02T16:00:16Z
Updated At: 2015-04-02T16:00:16Z
Body
Yeah, what I wanted to suggest is to loop instead of doing a recursive call to static::iteratorToArray()


Comment

User: @malukenho
Created On: 2015-04-09T19:21:46Z
Updated At: 2015-04-09T19:21:46Z
Body
@Ocramius I tried using foreach, but I ended up repeating a lot more code.


Comment

User: @Ocramius
Created On: 2015-04-15T07:44:16Z
Updated At: 2015-04-15T07:44:16Z
Body

but I ended up repeating a lot more code.

Yes, this happens a lot in performance-oriented code


Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants