clean code
This commit is contained in:
@@ -106,7 +106,7 @@ class Db
|
||||
{
|
||||
$stmt = $this->pdo->prepare($query->getQuery());
|
||||
$stmt = $this->bindParams($stmt, $query->getData());
|
||||
EventDispatcher::emit("on.query",$query);
|
||||
EventDispatcher::emit("on.query", $query);
|
||||
$stmt->execute();
|
||||
return $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
}
|
||||
@@ -115,7 +115,7 @@ class Db
|
||||
{
|
||||
$stmt = $this->pdo->prepare($query->getQuery());
|
||||
$stmt = $this->bindParams($stmt, $query->getData());
|
||||
EventDispatcher::emit("on.query",$query);
|
||||
EventDispatcher::emit("on.query", $query);
|
||||
return $stmt->execute();
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ class Db
|
||||
{
|
||||
$stmt = $this->pdo->prepare($query->getQuery());
|
||||
$stmt = $this->bindParams($stmt, $query->getData());
|
||||
EventDispatcher::emit("on.query",$query);
|
||||
EventDispatcher::emit("on.query", $query);
|
||||
$ok = $stmt->execute();
|
||||
if ($ok) {
|
||||
return $this->pdo->lastInsertId();
|
||||
|
||||
@@ -24,20 +24,16 @@ class EventDispatcher
|
||||
|
||||
public static function __callStatic($name, $arguments)
|
||||
{
|
||||
if(count($arguments)==2)
|
||||
{
|
||||
if (count($arguments) == 2) {
|
||||
$instance = self::getInstance();
|
||||
$event = $arguments[0];
|
||||
if($name=="on")
|
||||
{
|
||||
if(is_callable($arguments[1]))
|
||||
{
|
||||
$instance->emitter->on($event,$arguments[1]);
|
||||
if ($name == "on") {
|
||||
if (is_callable($arguments[1])) {
|
||||
$instance->emitter->on($event, $arguments[1]);
|
||||
}
|
||||
}
|
||||
if($name=="emit")
|
||||
{
|
||||
$instance->emitter->emit($event,$arguments);
|
||||
if ($name == "emit") {
|
||||
$instance->emitter->emit($event, $arguments);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user