Commit e87fa8f9 authored by Heiko Mettelsiefen's avatar Heiko Mettelsiefen 💬

some more files are cleaned

parent 378f9448
......@@ -13,10 +13,10 @@ class indexController {
public function indexAction($page) {
$page->title = 'simple-mvc';
$page->template('default');
$page->title = 'simple-mvc';
$page->template('default');
/* GET SIMPLE
/* GET SIMPLE
*
* Add a new pages with simple\Page
*
......@@ -29,7 +29,7 @@ class indexController {
# $url = 'blog/article/comment/';
# create an object of the type page
#$newPage = (new simple\Page($url));
#$newPage = (new simple\Page($url));
# add the new page to you manifest
#$newPage->add();
......
......@@ -23,8 +23,8 @@ class notFoundController {
/* How to create a new page
* create a new page included controller and views
*
* create a new page included controller and views
*
* first step, define the page / url
*
*/
......@@ -40,8 +40,8 @@ class notFoundController {
* this will generated follow files:
*
* /controller/blog.controller.php
* /render/views/blog.view.php (maybe for the list of all articles)
* /render/views/blog/article.view.php (a single blog post)
* /render/views/blog.view.php (maybe for the list of all articles)
* /render/views/blog/article.view.php (a single blog post)
*
*/
# $newPage->create();
......
<?
namespace simple;
class SRC {
/**
* Deliver sources from src directory
*
* @description
* https://gitlab.com/mascoda/simple-mvc/wikis/home
*
*/
public $path;
public $filename;
/*
* Constructor
*
* @description
* -
*
* @param
* -
*
* @return
* -
*
*/
function __construct()
{
// tbd
}
/*
* getContent
*
* @description
* get content from files in the src directory
*
* @param
* path (string)
* filename (string)
*
* @return
* content (string)
*
*/
public static function getContent($path, $filename)
{
return file_get_contents(dirname(__DIR__) . '/simplemvc/src/' . $path . '/' . $filename);
}
/*
* getContent
*
* @description
* get content from files in the src directory
*
* @param
* path (string)
* filename (string)
*
* @return
* content (string)
*
*/
public static function getJson($path, $filename)
{
return json_encode(SRC::getContent($path, $filename));
}
class SRC {
/**
* Deliver sources from src directory
*
* @description
* https://gitlab.com/mascoda/simple-mvc/wikis/home
*
*/
public $path;
public $filename;
/*
* Constructor
*
* @description
* -
*
* @param
* -
*
* @return
* -
*
*/
function __construct()
{
// tbd
}
/*
* getContent
*
* @description
* get content from files in the src directory
*
* @param
* path (string)
* filename (string)
*
* @return
* content (string)
*
*/
public static function getContent($path, $filename)
{
return file_get_contents(dirname(__DIR__) . '/simplemvc/src/' . $path . '/' . $filename);
}
/*
* getContent
*
* @description
* get content from files in the src directory
*
* @param
* path (string)
* filename (string)
*
* @return
* content (string)
*
*/
public static function getJson($path, $filename)
{
return json_encode(SRC::getContent($path, $filename));
}
}
\ No newline at end of file
<?
namespace simple;
class Tools {
/**
* Deliver sources from src directory
*
* @description
* https://gitlab.com/mascoda/simple-mvc/wikis/home
*
*/
function __construct()
{
// tbd
}
/*
* getContent
*
* @description
* array_merge_recursive_distinct does not change the datatypes of the values in the arrays.
class Tools {
/**
* Deliver sources from src directory
*
* @description
* https://gitlab.com/mascoda/simple-mvc/wikis/home
*
*/
function __construct()
{
// tbd
}
/*
* getContent
*
* @description
* array_merge_recursive_distinct does not change the datatypes of the values in the arrays.
* Matching keys' values in the second array overwrite those in the first array, as is the
* case with array_merge
*
* @param
* path (string)
* filename (string)
*
* @return
* content (string)
*
*/
public static function array_merge_recursive_distinct(array &$array1, array &$array2)
*
* @param
* path (string)
* filename (string)
*
* @return
* content (string)
*
*/
public static function array_merge_recursive_distinct(array &$array1, array &$array2)
{
$merged = $array1;
......@@ -43,5 +43,5 @@ namespace simple;
}
return $merged;
}
}
}
\ No newline at end of file
<?
namespace simple;
use HM;
class View {
/**
* Generate page with controller and view
*
* @description
* https://gitlab.com/mascoda/simple-mvc/wikis/home
*
*/
public $name;
class View {
/**
* Generate page with controller and view
*
* @description
* https://gitlab.com/mascoda/simple-mvc/wikis/home
*
*/
public $name;
public $action;
public $path;
public $filename;
public $filepath;
public $namespace;
/*
* Constructor
*
* @description
* build the complete page with controller and view
*/
function __construct($path) {
/*
* Constructor
*
* @description
* build the complete page with controller and view
*/
function __construct($path) {
$this->path = $path;
$this->setName();
$this->setAction();
$this->setFilename();
$this->setFilepath();
}
}
/*
* @description
* set name of controller
*/
private function setName() {
* @description
* set name of controller
*/
private function setName() {
if (strpos('/', $this->path) !== false) {
$this->name = $this->path;
} else {
......@@ -42,47 +42,47 @@ use HM;
$name = end($name);
$this->name = $name;
}
}
}
/*
* @description
* set name of the action
*/
private function setAction() {
* @description
* set name of the action
*/
private function setAction() {
$this->action = $this->name . 'Action';
}
/*
* @description
* returned the filename
*/
public function setFilename() {
}
/*
* @description
* returned the filename
*/
public function setFilename() {
$this->filename = $this->name . '.view.php';
}
}
/*
* @description
* returned the filepath
*/
public function setFilepath() {
* @description
* returned the filepath
*/
public function setFilepath() {
$this->filepath = dirname(__DIR__) . '/views/' . $this->path . '.view.php';
}
}
/*
* @description
* returned the Actions (array)
*/
public function getNamespace() {
* @description
* returned the Actions (array)
*/
public function getNamespace() {
return 'simpleController\\';
}
}
/*
* @description
* returned the filepath
*/
public function exists() {
* @description
* returned the filepath
*/
public function exists() {
return $exists = realpath($this->filepath) ? TRUE : FALSE;
}
}
/*
* @description
* create view file
*/
public function createFile() {
* @description
* create view file
*/
public function createFile() {
// create a new file object
$file = new HM\File(dirname(__DIR__) . '/views/' . $this->path . '/' . $this->filename);
......@@ -93,5 +93,5 @@ use HM;
// load default template and save
$file->write(SRC::getContent('view', 'default.view.php'));
}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment