Skip to content

Commit

Permalink
atualizacao
Browse files Browse the repository at this point in the history
  • Loading branch information
brunobmorais committed Sep 8, 2022
1 parent c8ad400 commit cfa3a82
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions src/DatalayerTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ trait DatalayerTrait
/**
* @return PDO|null
*/
private function getInstance()
private function getInstance(): ?PDO
{
if (strpos($_SERVER['SERVER_NAME'],"homologacao") && !strpos($this->database,"Homologacao") )
$this->database .= "Homologacao";
Expand Down Expand Up @@ -118,7 +118,7 @@ protected function fetchArrayObj($prepare=null): array
* @param String|null $class
* @return array|false
*/
protected function fetchArrayClass($prepare=null, String $class=null): array
protected function fetchArrayClass($prepare=null, String $class=null)
{
try {
$prepare = empty($prepare)?$this->prepare:$prepare;
Expand All @@ -136,7 +136,7 @@ protected function fetchArrayClass($prepare=null, String $class=null): array
* @param $prepare
* @return array|false
*/
protected function fetchOneAssoc($prepare=null): array
protected function fetchOneAssoc($prepare=null)
{
try {
$prepare = empty($prepare)?$this->prepare:$prepare;
Expand All @@ -152,7 +152,7 @@ protected function fetchOneAssoc($prepare=null): array
* @param $prepare
* @return array|false
*/
protected function fetchOneObj($prepare=null): array
protected function fetchOneObj($prepare=null)
{
try {
$prepare = empty($prepare)?$this->prepare:$prepare;
Expand All @@ -169,7 +169,7 @@ protected function fetchOneObj($prepare=null): array
* @param String|null $class
* @return array|false
*/
protected function fetchOneClass($prepare=null, String $class=null): array
protected function fetchOneClass($prepare=null, String $class=null)
{
try {
$prepare = empty($prepare)?$this->prepare:$prepare;
Expand All @@ -185,7 +185,7 @@ protected function fetchOneClass($prepare=null, String $class=null): array
/**
* @return bool
*/
protected function beginTrasaction()
protected function beginTrasaction(): bool
{
try {
$this->getInstance();
Expand All @@ -201,7 +201,8 @@ protected function beginTrasaction()
/**
* @return bool
*/
protected function commitTransaction(){
protected function commitTransaction(): bool
{
try {
$this->getInstance();
$this->instance->commit();
Expand All @@ -215,7 +216,8 @@ protected function commitTransaction(){
/**
* @return bool
*/
protected function rollBackTransaction(){
protected function rollBackTransaction(): bool
{

try {
$this->getInstance();
Expand Down Expand Up @@ -268,7 +270,7 @@ protected function selectDB($sql, $params = null, $class = null)
* @param $params
* @return bool
*/
protected function insertDB($sql, $params = null)
protected function insertDB($sql, $params = null): bool
{
try {
$this->getInstance();
Expand All @@ -286,7 +288,7 @@ protected function insertDB($sql, $params = null)
* @param $params
* @return bool
*/
protected function updateDB($sql, $params = null)
protected function updateDB($sql, $params = null): bool
{
try {
$this->getInstance();
Expand All @@ -304,7 +306,7 @@ protected function updateDB($sql, $params = null)
* @param $params
* @return bool
*/
protected function deleteDB($sql, $params = null)
protected function deleteDB($sql, $params = null): bool
{
try {
$this->getInstance();;
Expand All @@ -320,7 +322,7 @@ protected function deleteDB($sql, $params = null)
/**
* @return array
*/
protected function printErrorInfo()
protected function printErrorInfo(): array
{
return $this->getInstance($this->database)->errorInfo();
}
Expand Down

0 comments on commit cfa3a82

Please sign in to comment.