config
This commit is contained in:
10
app_old/aldarien/view/.gitignore
vendored
Normal file
10
app_old/aldarien/view/.gitignore
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
composer.phar
|
||||
/vendor/
|
||||
|
||||
# Commit your application's lock file http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file
|
||||
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
|
||||
# composer.lock
|
||||
|
||||
.settings
|
||||
.buildpath
|
||||
.project
|
21
app_old/aldarien/view/LICENSE
Normal file
21
app_old/aldarien/view/LICENSE
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2017 Aldarien
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
2
app_old/aldarien/view/README.md
Normal file
2
app_old/aldarien/view/README.md
Normal file
@ -0,0 +1,2 @@
|
||||
# view
|
||||
View module for my apps
|
30
app_old/aldarien/view/app/Contract/View.php
Normal file
30
app_old/aldarien/view/app/Contract/View.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
namespace App\Contract;
|
||||
|
||||
use App\Alias\RemoteConnection;
|
||||
use App\Definition\Contract;
|
||||
use App\Service\Money;
|
||||
use App\Service\Remote;
|
||||
use App\Service\View as ViewService;
|
||||
use GuzzleHttp\Client;
|
||||
|
||||
class View
|
||||
{
|
||||
use Contract;
|
||||
|
||||
protected static function newInstance()
|
||||
{
|
||||
$remote = new Remote(new RemoteConnection());
|
||||
$money = (new Money(new Client([
|
||||
'base_uri' => "http://{$remote->getIP()}:8008",
|
||||
'headers' => ['Accept' => 'application/json']
|
||||
])));
|
||||
return new ViewService(['money' => $money]);
|
||||
}
|
||||
public static function show($template, $variables = null)
|
||||
{
|
||||
$instance = self::getInstance();
|
||||
return $instance->show($template, $variables);
|
||||
}
|
||||
}
|
||||
?>
|
5
app_old/aldarien/view/app/Helper/functions.php
Normal file
5
app_old/aldarien/view/app/Helper/functions.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
function view($template, $variables = null) {
|
||||
return \App\Contract\View::show($template, $variables);
|
||||
}
|
||||
?>
|
27
app_old/aldarien/view/app/Service/View.php
Normal file
27
app_old/aldarien/view/app/Service/View.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
namespace App\Service;
|
||||
|
||||
use eftec\bladeone\BladeOne;
|
||||
|
||||
class View
|
||||
{
|
||||
protected $views;
|
||||
protected $cache;
|
||||
protected $blade;
|
||||
|
||||
public function __construct(array $variables = [])
|
||||
{
|
||||
$this->views = config('locations.views');
|
||||
$this->cache = config('locations.cache');
|
||||
|
||||
$this->blade = new BladeOne($this->views, $this->cache, null, $variables);
|
||||
}
|
||||
public function show($template, $vars = null)
|
||||
{
|
||||
if ($vars) {
|
||||
return $this->blade->run($template, $vars);
|
||||
}
|
||||
return $this->blade->run($template);
|
||||
}
|
||||
}
|
||||
?>
|
28
app_old/aldarien/view/composer.json
Normal file
28
app_old/aldarien/view/composer.json
Normal file
@ -0,0 +1,28 @@
|
||||
{
|
||||
"name": "aldarien/view",
|
||||
"description": "View module for my apps",
|
||||
"type": "library",
|
||||
"require": {
|
||||
"eftec/bladeone": "*",
|
||||
"aldarien/contract": "*",
|
||||
"aldarien/config": "*"
|
||||
},
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Aldarien",
|
||||
"email": "aldarien85@gmail.com"
|
||||
}
|
||||
],
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"App\\": "app"
|
||||
},
|
||||
"files": [
|
||||
"app/Helper/functions.php"
|
||||
]
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "*"
|
||||
}
|
||||
}
|
8
app_old/aldarien/view/config/locations.php
Normal file
8
app_old/aldarien/view/config/locations.php
Normal file
@ -0,0 +1,8 @@
|
||||
<?php
|
||||
return [
|
||||
'base' => root(),
|
||||
'cache' => '{locations.base}/cache',
|
||||
'resources' => '{locations.base}/resources',
|
||||
'views' => '{locations.resources}/views'
|
||||
];
|
||||
?>
|
17
app_old/aldarien/view/phpunit.xml
Normal file
17
app_old/aldarien/view/phpunit.xml
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phpunit
|
||||
colors="true"
|
||||
verbose="true"
|
||||
bootstrap="./vendor/autoload.php"
|
||||
>
|
||||
<testsuites>
|
||||
<testsuite name="Application Test Suite">
|
||||
<directory>./tests/</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<filter>
|
||||
<whitelist>
|
||||
<directory>./app</directory>
|
||||
</whitelist>
|
||||
</filter>
|
||||
</phpunit>
|
5
app_old/aldarien/view/public/index.php
Normal file
5
app_old/aldarien/view/public/index.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
include_once dirname(__DIR__) . '/vendor/autoload.php';
|
||||
|
||||
echo view('base');
|
||||
?>
|
9
app_old/aldarien/view/resources/views/base.blade.php
Normal file
9
app_old/aldarien/view/resources/views/base.blade.php
Normal file
@ -0,0 +1,9 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>View</title>
|
||||
</head>
|
||||
<body>
|
||||
View test
|
||||
</body>
|
||||
</html>
|
22
app_old/aldarien/view/tests/ViewTest.php
Normal file
22
app_old/aldarien/view/tests/ViewTest.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class ViewTest extends TestCase
|
||||
{
|
||||
public function testView()
|
||||
{
|
||||
$output = <<<DATA
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>View</title>
|
||||
</head>
|
||||
<body>
|
||||
View test
|
||||
</body>
|
||||
</html>
|
||||
DATA;
|
||||
$this->assertEquals($output, view('base'));
|
||||
}
|
||||
}
|
||||
?>
|
Reference in New Issue
Block a user