-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from vrkansagara/develop
Code merge.
- Loading branch information
Showing
12 changed files
with
1,097 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
/vendor/ | ||
.idea/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,10 +20,41 @@ | |
}, | ||
"autoload": { | ||
"psr-4": { | ||
"Vrkansagara\\": "src/" | ||
} | ||
"Vrkansagara\\LaraOutPress\\": "src/" | ||
}, | ||
"files": [ | ||
"src/helper.php" | ||
] | ||
}, | ||
"support": { | ||
"email": "[email protected]" | ||
"email": "[email protected]", | ||
"issues": "https://github.com/vrkansagara/LaraOutPress/issues", | ||
"source": "https://github.com/vrkansagara/LaraOutPress" | ||
}, | ||
"minimum-stability": "dev", | ||
"prefer-stable": true, | ||
"extra": { | ||
"laravel": { | ||
"branch-alias": { | ||
"dev-master": "develop" | ||
}, | ||
"providers": [ | ||
"Vrkansagara\\LaraOutPress\\ServiceProvider" | ||
], | ||
"aliases": { | ||
"LaraOutPress": "Vrkansagara\\LaraOutPress\\Facade" | ||
} | ||
} | ||
}, | ||
"require": { | ||
"php": ">=7.0" | ||
}, | ||
"require-dev": { | ||
"laravel/framework": "5.5.x" | ||
}, | ||
"scripts": { | ||
"post-autoload-dump": [ | ||
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
return [ | ||
/* | ||
|-------------------------------------------------------------------------- | ||
| LaraOutPress Settings | ||
|-------------------------------------------------------------------------- | ||
| | ||
| LaraOutPress is disabled by default, when enabled is set to true in app.php. | ||
| You can override the value by setting enable to true or false instead of null. | ||
| | ||
*/ | ||
'enabled' => env('VRKANSAGARA_COMPRESS_ENABLED', false), | ||
|
||
'debug' => env('VRKANSAGARA_COMPRESS_DEBUG', false), | ||
|
||
'target_environment' => env('VRKANSAGARA_COMPRESS_ENVIRONMENT', '') | ||
|
||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
namespace Vrkansagara\LaraOutPress; | ||
|
||
/** | ||
* @copyright Copyright (c) 2015-2019 Vallabh Kansagara <[email protected]> | ||
* @license https://opensource.org/licenses/BSD-3-Clause New BSD License | ||
*/ | ||
|
||
class Facade extends \Illuminate\Support\Facades\Facade | ||
{ | ||
/** | ||
* {@inheritDoc} | ||
*/ | ||
protected static function getFacadeAccessor() | ||
{ | ||
return LaraOutPress::class; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
<?php | ||
|
||
namespace Vrkansagara\LaraOutPress; | ||
|
||
use Illuminate\Contracts\Foundation\Application; | ||
|
||
/** | ||
* @copyright Copyright (c) 2015-2019 Vallabh Kansagara <[email protected]> | ||
* @license https://opensource.org/licenses/BSD-3-Clause New BSD License | ||
*/ | ||
class LaraOutPress | ||
{ | ||
|
||
/** | ||
* The Laravel application instance. | ||
* | ||
* @var \Illuminate\Foundation\Application | ||
*/ | ||
protected $app; | ||
|
||
/** | ||
* Normalized Laravel Version | ||
* | ||
* @var string | ||
*/ | ||
protected $version; | ||
|
||
/** | ||
* True when enabled, false disabled an null for still unknown | ||
* | ||
* @var bool | ||
*/ | ||
protected $enabled; | ||
|
||
|
||
/** | ||
* @var null | ||
*/ | ||
protected $config; | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getVersion() | ||
{ | ||
return $this->version; | ||
} | ||
|
||
/** | ||
* @param string $version | ||
*/ | ||
public function setVersion($version) | ||
{ | ||
$this->version = $version; | ||
} | ||
|
||
/** | ||
* @return \Illuminate\Foundation\Application | ||
*/ | ||
public function getApp() | ||
{ | ||
return $this->app; | ||
} | ||
|
||
/** | ||
* @param \Illuminate\Foundation\Application $app | ||
*/ | ||
public function setApp($app) | ||
{ | ||
$this->app = $app; | ||
} | ||
|
||
|
||
/** | ||
* @param Application $app | ||
*/ | ||
public function __construct($app = null) | ||
{ | ||
if (!$app) { | ||
$app = app(); //Fallback when $app is not given | ||
} | ||
$this->setApp($app); | ||
$this->setConfig(); | ||
$this->setEnabled(); | ||
$this->setVersion($app->version()); | ||
} | ||
|
||
/** | ||
* @return null | ||
*/ | ||
public function getConfig() | ||
{ | ||
return $this->config; | ||
} | ||
|
||
/** | ||
* @param null $config | ||
*/ | ||
public function setConfig() | ||
{ | ||
$applicationConfig = $this->app['config']; | ||
$this->config = $applicationConfig->get('laraoutpress'); | ||
} | ||
|
||
/** | ||
* @return bool | ||
*/ | ||
public function isEnabled() | ||
{ | ||
return $this->enabled; | ||
} | ||
|
||
/** | ||
* @return bool | ||
*/ | ||
public function setEnabled() | ||
{ | ||
if ($this->enabled === null) { | ||
$config = $this->config; | ||
$configEnabled = value($config['enabled']); | ||
$this->enabled = ($configEnabled && !$this->app->runningInConsole()) ? $configEnabled : false; | ||
} | ||
return $this->enabled; | ||
} | ||
|
||
|
||
} |
Oops, something went wrong.