Made BlogListGenerator PSR-2 conform

This commit is contained in:
Marcel Kapfer (mmk2410) 2016-12-29 21:54:37 +01:00
parent 0bb2dede4d
commit 89e756819d
5 changed files with 16 additions and 9 deletions

View file

@ -25,7 +25,10 @@ date_default_timezone_set('UTC');
require __DIR__ . '/vendor/autoload.php'; // loading composer libs
require './res/php/Config.php';
require_once './res/php/BlogListGenerator.php';
use mmk2410\rbe\config\Config as Config;
use mmk2410\rbe\BlogListGenerator\BlogListGenerator as BlogListGenerator;
$configParser = new Config('config.yaml', 'vendor/autoload.php');
@ -33,7 +36,7 @@ $config = $configParser->getConfig();
require './lang/' . $config["language"] . ".php"; // Language file
require_once 'res/php/ArticleGenerator.php'; // The article generator
require_once './res/php/BlogListGenerator.php'; // and the blog list generator
// Getting some variables ($_GET and $_SERVER)
$getblog = filter_input(INPUT_GET, "blog"); // get the blog variable

View file

@ -35,8 +35,10 @@
require '../vendor/autoload.php';
require '../res/php/Config.php';
require "./../res/php/BlogListGenerator.php";
use \mmk2410\rbe\config\Config as Config;
use mmk2410\rbe\BlogListGenerator\BlogListGenerator as BlogListGenerator;
$config = new Config("../config.yaml", '../vendor/autoload.php');
$settings = $config->getConfig();
@ -108,7 +110,7 @@ if ($config["rcc"]["rcc"] == "on") {
} else {
if (password_verify($passwd, $password)) {
$_SESSION['login'] = true;
include_once "./../res/php/BlogListGenerator.php";
?>
<!-- Post Upload -->

View file

@ -10,7 +10,7 @@
* @license MIT License
* @link http://marcel-kapfer.de/rangitaki
*/
namespace mmk2410\rbe\BlogListGenerator;
/**
* The blog list generator class is a collection of functions for generating
@ -37,7 +37,7 @@ class BlogListGenerator
*
* @return None
*/
function listBlog($directory, $blogname, $blogmaintitle)
public function listBlog($directory, $blogname, $blogmaintitle)
{
// get content of the blog file;
$blog = file_get_contents($directory . $blogname);
@ -74,7 +74,7 @@ class BlogListGenerator
*
* @return string
*/
function getName($file)
public function getName($file)
{
// get the content of the blog file
$blog = file_get_contents($file);
@ -96,7 +96,7 @@ class BlogListGenerator
*
* @return int Amount of files
*/
static function getArticleAmount($blog)
public static function getArticleAmount($blog)
{
$directory = "./articles/" . $blog . "/";
if (!file_exists($directory)) {
@ -112,5 +112,4 @@ class BlogListGenerator
return $i;
}
}
}

View file

@ -11,6 +11,7 @@
* @link http://marcel-kapfer.de/rangitaki
*/
require_once "BlogListGenerator.php";
use mmk2410\rbe\BlogListGenerator\BlogListGenerator as BlogListGenerator;
require_once './res/php/Config.php';

View file

@ -1,7 +1,9 @@
<?php
require_once 'PHPUnit/Autoload.php';
include 'res/php/BlogListGenerator.php';
require_once 'res/php/BlogListGenerator.php';
use mmk2410\rbe\BlogListGenerator\BlogListGenerator as BlogListGenerator;
class BlogListGeneratorTest extends \PHPUnit_Framework_TestCase
{