Skip to content
This repository was archived by the owner on Apr 14, 2018. It is now read-only.

Commit c24d362

Browse files
committed
fixes
1 parent 612c5e6 commit c24d362

File tree

5 files changed

+15
-78
lines changed

5 files changed

+15
-78
lines changed

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@
3232
"squizlabs/php_codesniffer": "^2.3"
3333
},
3434
"autoload": {
35-
"files": [
36-
"src/Loader.php"
37-
],
3835
"psr-4": {
3936
"Shieldfy\\": "src"
4037
}
4138
},
4239
"autoload-dev": {
40+
"files": [
41+
"src/Helper.php"
42+
],
4343
"psr-4": {
4444
"Shieldfy\\": "tests"
4545
}

src/Config.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ public function getBaseDirectory()
6060
{
6161

6262
// -- first method --
63+
//
6364
//search stack for find original folder from composer folder
6465
$stack = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
6566
foreach($stack as $frame)
@@ -69,20 +70,21 @@ public function getBaseDirectory()
6970
break;
7071
}
7172
}
72-
if(file_exists($baseDirectory1.DIRECTORY_SEPARATOR.'shieldfy.json')){
73+
74+
if(isset($baseDirectory1) && file_exists($baseDirectory1.DIRECTORY_SEPARATOR.'composer.json')){
7375
return $baseDirectory1;
7476
}
7577

7678
// -- second method --
7779
$firstFrame = $stack[count($stack) - 1];
7880
$baseDirectory2 = dirname($firstFrame['file']);
79-
if(file_exists($baseDirectory2.DIRECTORY_SEPARATOR.'shieldfy.json')){
81+
if(file_exists($baseDirectory2.DIRECTORY_SEPARATOR.'composer.json')){
8082
return $baseDirectory2;
8183
}
8284

8385
// -- third method --
8486
$baseDirectory3 = realpath($baseDirectory2.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR);
85-
if(file_exists($baseDirectory3.DIRECTORY_SEPARATOR.'shieldfy.json')){
87+
if(file_exists($baseDirectory3.DIRECTORY_SEPARATOR.'composer.json')){
8688
return $baseDirectory3;
8789
}
8890

src/Helper.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
if(!defined('DIRECTORY_SEPARATOR')) define('DIRECTORY_SEPARATOR','/');
3+
if(!defined('SHIELDFY_IS_HERE')) define('SHIELDFY_IS_HERE',true);
4+
5+
if(function_exists('uopz_allow_exit')){
6+
uopz_allow_exit(true);
7+
}

src/Http/ApiClient.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ public function request($url, $body)
109109
*/
110110
public function parseResult($result)
111111
{
112-
print_r($result);
113112
$res = json_decode($result);
114113
if (!$res) {
115114
$this->errors = [

src/Loader.php

Lines changed: 0 additions & 71 deletions
This file was deleted.

0 commit comments

Comments
 (0)