Skip to content

Commit

Permalink
Merge branch 'release/0.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
beMang committed Apr 27, 2018
2 parents c66f6a0 + bfe60e5 commit a58f11c
Show file tree
Hide file tree
Showing 41 changed files with 349 additions and 338 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/.vscode/
*.log
*.cache
/vendor/
/tmp/cache/twig/*
Expand Down
11 changes: 9 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
language: php

php:
- nightly
7.1.9

install:
- composer install
- composer dump -o

cache:
directories:
- vendor

script:
./vendor/bin/phpunit
./vendor/bin/phpunit --coverage-clover build/logs/clover.xml

after_success:
travis_retry php vendor/bin/php-coveralls
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Le framework phpGone est en cours de développement, la documentation sera écri
## Statut de build
* Master : [![Build Status](https://travis-ci.org/beMang/phpgone.svg?branch=master)](https://travis-ci.org/beMang/phpgone)
* Branch dev : [![Build Status](https://travis-ci.org/beMang/phpgone.svg?branch=develop)](https://travis-ci.org/beMang/phpgone)
* Code coverage branch master : [![Coverage Status](https://coveralls.io/repos/github/beMang/phpgone/badge.svg?branch=master)](https://coveralls.io/github/beMang/phpgone?branch=master)
* Code coverage branch dev : [![Coverage Status](https://coveralls.io/repos/github/beMang/phpgone/badge.svg?branch=develop)](https://coveralls.io/github/beMang/phpgone?branch=develop)

**Cette page est totalement dépréciée**

Expand Down
5 changes: 5 additions & 0 deletions app/Controllers/Show/Show.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,9 @@ public function executeIndex(\Psr\Http\Message\ServerRequestInterface $request)
{
$this->getRenderer()->twigRender('Show/index.twig', []);
}

public function executeDoc(\Psr\Http\Message\ServerRequestInterface $request){
$this->getRenderer()->twigRender('Show/index.twig', []);
$this->getRenderer()->render('Show/doc', []);
}
}
3 changes: 2 additions & 1 deletion app/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
'defaultMainRender' => 'Twig',
'defaultAsset' => 'site',
'routes' => [
new Route('^[\/]$', 'Show\Show', 'index', ['test'])
new Route('^[\/]$', 'Show\Show', 'index', ['test']),
new Route('/doc', 'Show\Show', 'Doc', [])
],
'viewError404' => 'Error/show.twig'
];
1 change: 1 addition & 0 deletions app/views/Show/doc.php
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<h1>La documentation va être écrite</h1>
3 changes: 0 additions & 3 deletions app/views/Show/test.php

This file was deleted.

5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
},
"require-dev": {
"phpunit/phpunit": "^6.5",
"squizlabs/php_codesniffer": "^3.0@dev"
"squizlabs/php_codesniffer": "^3.0@dev",
"php-coveralls/php-coveralls": "2.0.x-dev"
},
"autoload": {
"psr-4": {
Expand All @@ -22,4 +23,4 @@
"phpGoneHelpers\\": "core/Helpers"
}
}
}
}
2 changes: 1 addition & 1 deletion core/Core/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function run()
public function send()
{
$responseSender = new \phpGone\Core\ResponseSender();
$responseSender->send($this->httpResponse);
return $responseSender->send($this->httpResponse);
}

public function setHttpResponse(\Psr\Http\Message\ResponseInterface $response)
Expand Down
5 changes: 0 additions & 5 deletions core/Core/ApplicationComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,4 @@ public function getConfig()
{
return $this->getApp()->getConfig();
}

public function setApp(\phpGone\Core\Application $app)
{
$this->app = $app;
}
}
14 changes: 0 additions & 14 deletions core/Core/BackController.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,20 +54,6 @@ public function execute()
$this->$method($this->app->getRequest());
}

/**
* Défini le module du controller
*
* @param string $module Module à définir
* @return \InvalidArgumentException Si erreur
*/
public function setModule($module)
{
if (!is_string($module) || empty($module)) {
throw new \InvalidArgumentException('Le module doit être une chaine de caractères valide');
}
$this->module = $module;
}

/**
* Défini l'action à executer
*
Expand Down
7 changes: 1 addition & 6 deletions core/Core/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,11 @@ class Config
protected $config = [];
protected $configFiles;

public function getConfig()
public function getConfigArray()
{
return $this->config;
}

public function getConfigFile()
{
return $this->configFiles;
}

public function get($key)
{
if (!empty($this->config[$key])) {
Expand Down
6 changes: 3 additions & 3 deletions core/Core/MiddlewaresDispatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class MiddlewaresDispatcher extends ApplicationComponent
*
* @var string[]
*/
protected $middlewares = ['CoreMiddleware', 'NotFoundMiddleware'];
protected $middlewares = [\phpGone\Middlewares\CoreMiddleware::class, \phpGone\Middlewares\NotFoundMiddleware::class];

/**
* Index à utiliser pour parcourir les middlwares
Expand Down Expand Up @@ -53,7 +53,7 @@ public function process(\Psr\Http\Message\ServerRequestInterface $request)
{
$middleware = $this->getMiddleware();
if (is_null($middleware)) {
return false;
throw new \RuntimeException('Aucun middleware a été défini');
}
return call_user_func_array($middleware, [$request, [$this, 'process']]);
}
Expand All @@ -66,7 +66,7 @@ public function process(\Psr\Http\Message\ServerRequestInterface $request)
private function getMiddleware()
{
if (array_key_exists($this->middlewaresIndex, $this->middlewares)) {
$middleWareClass = '\\phpGone\Middlewares\\' . $this->middlewares[$this->middlewaresIndex];
$middleWareClass = $this->middlewares[$this->middlewaresIndex];
$middleware = new $middleWareClass($this->getApp());
$this->middlewaresIndex++;
return $middleware;
Expand Down
1 change: 1 addition & 0 deletions core/Core/ResponseSender.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,6 @@ public function send(\Psr\Http\Message\ResponseInterface $response)
while (!$stream->eof()) {
echo $stream->read(1024 * 8);
}
return true;
}
}
14 changes: 1 addition & 13 deletions core/Core/baseConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,8 @@
* @author Antonutti Adrien <antonuttiadrien@email.com>
*/

//USAGE

use phpGone\Log\Logger;
use phpGone\Router\Routeur;
use phpGone\Session\Session;
use GuzzleHttp\Psr7\Response;
use phpGone\Core\Application;
use phpGone\Renderer\PhpRenderer;
use phpGone\Database\DatabasePDO;
use phpGone\Renderer\TwigRenderer;
use phpGone\Core\MiddlewaresDispatcher;

return[
'TwigExtensions' => [
phpGone\Renderer\TwigExtensions\FormExtension::class
phpGone\Renderer\TwigExtensions\UrlExtension::class
]
];
52 changes: 0 additions & 52 deletions core/Helpers/FileManager.php

This file was deleted.

7 changes: 3 additions & 4 deletions core/Session/Session.php → core/Helpers/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,14 @@
* @copyright 2017 Antonutti Adrien
* @author Antonutti Adrien <antonuttiadrien@email.com>
*/
namespace phpGone\Session;
namespace phpGone\Helpers;

/**
* Class Session
* Gestion des sessions simples (pour l'utiliser le session_start() doit être bien démarré)
*/
class Session
class Session extends Helper
{
use FlashTrait;
/**
* Ajoute un attribut à la session
*
Expand Down Expand Up @@ -63,7 +62,7 @@ public function getAttr($key)
* @param string $key Clé de l'attribut à supprimer
* @return void
*/
public function removeAttr($attr) :void
public function removeAttr($key) :void
{
unset($_SESSION[$key]);
}
Expand Down
19 changes: 19 additions & 0 deletions core/Helpers/Url.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace phpGone\Helpers;

use phpGone\Helpers\Helper;

class Url extends Helper{
public function getTmpPath(){
return __DIR__ . '/../../tmp/';
}

public function getAppPath(){
return __DIR__ . '/../../app/';
}

public function getTestsPath(){
return __DIR__ . '/../../tests/';
}
}
31 changes: 0 additions & 31 deletions core/Log/LogLevel.php

This file was deleted.

0 comments on commit a58f11c

Please sign in to comment.