Skip to content

Commit

Permalink
Fixed Invalid argument supplied for foreach()
Browse files Browse the repository at this point in the history
  • Loading branch information
Phil Sturgeon committed Jun 9, 2014
1 parent cdf7e41 commit ba967b1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,21 @@ public function getSerializer()
**/
public function parseIncludes($includes)
{
if (empty($includes)) {
return $this;
}

// Wipe these before we go again
$this->requestedIncludes = $this->includeParams = array();

if (is_string($includes)) {
$includes = explode(',', $includes);
}

if (! is_array($includes)) {
throw new InvalidArgumentException('The parseIncludes() method expects a string or an array');
}

foreach ($includes as $include) {

list($includeName, $allModifiersStr) = array_pad(explode(':', $include, 2), 2, null);
Expand Down

0 comments on commit ba967b1

Please sign in to comment.