Skip to content

Commit

Permalink
Integrate wirecard
Browse files Browse the repository at this point in the history
  • Loading branch information
LOUARDI Abdeltif committed Feb 17, 2012
1 parent 4d80f3a commit 1faacba
Show file tree
Hide file tree
Showing 5 changed files with 576 additions and 4 deletions.
12 changes: 9 additions & 3 deletions PaymentFactory.php
Expand Up @@ -17,16 +17,21 @@ public function __call($name, $arguments)
return $this->getPlugin()->$name($arguments);
}

public function getPlugin()
public function getPlugin($plugin = null)
{
if ($plugin) {
$this->setPlugin($plugin);
}

return $this->plugin;
}

public function setPlugin($plugin)
{
$exists = true;
if (!class_exists($plugin))
if (!class_exists($plugin)) {
$exists = false;
}

if (!class_exists(sprintf('OS\\PaymentBundle\\Plugins\\%s', $plugin)) && !$exists) {
$exists = false;
Expand All @@ -35,8 +40,9 @@ public function setPlugin($plugin)
$exists = true;
}

if ($exists == false)
if ($exists == false) {
throw new Exception(sprintf('Plugin %s not found.', $plugin));
}

$this->plugin = new $plugin;

Expand Down

0 comments on commit 1faacba

Please sign in to comment.