Skip to content

Commit

Permalink
AutoLoadEnv Start - Error Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Fredrick Peter committed May 20, 2023
1 parent fcc4a67 commit 15411f1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ Prior to installing `php-orm-database` get the [Composer](https://getcomposer.or
**Step 1** — update your `composer.json`:
```composer.json
"require": {
"peterson/php-orm-database": "^3.1.9"
"peterson/php-orm-database": "^4.0.1"
}
```

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
},
"extra": {
"branch-alias": {
"dev-main": "3.1.9-dev"
"dev-main": "4.0.1-dev"
}
},
"minimum-stability": "stable",
Expand Down
22 changes: 11 additions & 11 deletions src/AutoloadEnv.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ static protected function createDummy()
// only create when files are not present
if(self::isDummyNotPresent()){
// create for init
if(!file_exists($paths['init']['path']) && !is_dir($paths['init']['path'])){
if(!file_exists($paths['init']['path'])){
// Read the contents of the dummy file
$dummyContent = file_get_contents($paths['init']['dummy']);

Expand All @@ -201,7 +201,7 @@ static protected function createDummy()
}

// create for gitignore
if(!file_exists($paths['gitignore']['path']) && !is_dir($paths['gitignore']['path'])){
if(!file_exists($paths['gitignore']['path'])){
// Read the contents of the dummy file
$dummyContent = file_get_contents($paths['gitignore']['dummy']);

Expand All @@ -210,7 +210,7 @@ static protected function createDummy()
}

// create for htaccess
if(!file_exists($paths['htaccess']['path']) && !is_dir($paths['htaccess']['path'])){
if(!file_exists($paths['htaccess']['path'])){
// Read the contents of the dummy file
$dummyContent = file_get_contents($paths['htaccess']['dummy']);

Expand All @@ -219,7 +219,7 @@ static protected function createDummy()
}

// create for phpini
if(!file_exists($paths['phpini']['path']) && !is_dir($paths['phpini']['path'])){
if(!file_exists($paths['phpini']['path'])){
// Read the contents of the dummy file
$dummyContent = file_get_contents($paths['phpini']['dummy']);

Expand All @@ -228,7 +228,7 @@ static protected function createDummy()
}

// create for userini
if(!file_exists($paths['userini']['path']) && !is_dir($paths['userini']['path'])){
if(!file_exists($paths['userini']['path'])){
// Read the contents of the dummy file
$dummyContent = file_get_contents($paths['userini']['dummy']);

Expand All @@ -249,33 +249,33 @@ static private function isDummyNotPresent()
$present = [false];

// create for init
if(file_exists($paths['init']['path']) && !is_dir($paths['init']['path'])){
if(!file_exists($paths['init']['path'])){
$present[] = true;
}

// create for gitignore
if(file_exists($paths['gitignore']['path']) && !is_dir($paths['gitignore']['path'])){
if(!file_exists($paths['gitignore']['path'])){
$present[] = true;
}

// create for htaccess
if(file_exists($paths['htaccess']['path']) && !is_dir($paths['htaccess']['path'])){
if(!file_exists($paths['htaccess']['path'])){
$present[] = true;
}

// create for phpini
if(file_exists($paths['phpini']['path']) && !is_dir($paths['phpini']['path'])){
if(!file_exists($paths['phpini']['path'])){
$present[] = true;
}

// create for userini
if(file_exists($paths['userini']['path']) && !is_dir($paths['userini']['path'])){
if(!file_exists($paths['userini']['path'])){
$present[] = true;
}

// Check if all elements in $present are false
$allFalse = empty(array_filter($present));

// All elements in $present are false
if ($allFalse) {
return false;
Expand Down

0 comments on commit 15411f1

Please sign in to comment.