1 Commits

Author SHA1 Message Date
9ec9fdd731 v2.0.0 2022-09-08 20:03:20 -04:00
3 changed files with 6 additions and 32 deletions

View File

@ -11,10 +11,5 @@
"email": "aldarien85@gmail.com"
}
],
"require": {},
"autoload": {
"psr-4": {
"ProVM\\": "src/"
}
}
"require": {}
}

View File

@ -9,6 +9,5 @@ interface ResultSet
public function execute(array $values): ResultSet;
public function getAsArray(): array;
public function getAsObject(): array;
public function getFirstAsArray(): array;
public function getFirstAsObject(): object;
public function getFirst(): mixed;
}

View File

@ -31,34 +31,14 @@ class ResultSet implements RSInterface
public function getAsArray(): array
{
$rs = $this->getStatement()->fetchAll(PDO::FETCH_ASSOC);
if (!$rs) {
throw new \PDOException("No results found.");
}
return $rs;
return $this->getStatement()->fetchAll(PDO::FETCH_ASSOC);
}
public function getAsObject(): array
{
$rs = $this->getStatement()->fetchAll(PDO::FETCH_OBJ);
if (!$rs) {
throw new \PDOException("No results found.");
}
return $rs;
return $this->getStatement()->fetchAll(PDO::FETCH_OBJ);
}
public function getFirstAsArray(): array
public function getFirst(): mixed
{
$rs = $this->getStatement()->fetch(PDO::FETCH_ASSOC);
if (!$rs or count($rs) === 0) {
throw new \PDOException("No results found.");
}
return $rs;
}
public function getFirstAsObject(): object
{
$rs = $this->getStatement()->fetch(PDO::FETCH_OBJ);
if (!$rs or count($rs) === 0) {
throw new \PDOException("No results found.");
}
return $rs;
return $this->getStatement()->fetch(PDO::FETCH_OBJ);
}
}