Skip to content

Commit

Permalink
Fix ListItem camel-case classname
Browse files Browse the repository at this point in the history
  • Loading branch information
shadz3rg authored Aug 7, 2017
1 parent 5717779 commit 5f29c5c
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/PHPStamp/Document/WordDocument.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,16 @@ public function cleanup(\DOMDocument $template)
*/
public function getExpression($id, Tag $tag)
{
$className = 'PHPStamp\\Document\\WordDocument\\Extension\\' . ucfirst($id);

if (class_exists($className) === false) {
throw new InvalidArgumentException('Class by id ' . $id . ' not found.');
}

$available = array(
'cell' => 'PHPStamp\\Document\\WordDocument\\Extension\\Cell',
'listitem' => 'PHPStamp\\Document\\WordDocument\\Extension\\ListItem',
);

if (isset($available[$id]) === false) {
throw new InvalidArgumentException('Class by id "' . $id . '" not found.');
}

$className = $available[$id];
return new $className($tag);
}
}
}

0 comments on commit 5f29c5c

Please sign in to comment.