Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
bakeiro committed Dec 7, 2020
1 parent 9069a11 commit d2a60b3
Show file tree
Hide file tree
Showing 15 changed files with 8 additions and 44 deletions.
9 changes: 4 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
"@solve-lint"
],
"lint": [
"phpcs --extensions=php --encoding=utf-8 -n -s --colors --standard=PSR1,PSR12,ruleset.xml --ignore=public/*,system/composer/*,node_modules/* ./ "
"phpcs --encoding=utf-8 -n -s --colors --standard=PSR1,PSR12,PEAR --exclude=PEAR.Commenting.ClassComment,PEAR.Commenting.FileComment,PEAR.Commenting.FunctionComment --ignore=node_modules/*,system/composer/*,public/* ./ "
],
"fix-lint": [
"phpcbf --extensions=php --encoding=utf-8 -n -s --colors --standard=PSR1,PSR12,ruleset.xml --ignore=public/*,system/composer/*,node_modules/* ./ "
"phpcbf --encoding=utf-8 -n --colors --standard=PSR1,PSR12,PEAR --exclude=PEAR.Commenting.ClassComment,PEAR.Commenting.FileComment --ignore=node_modules/*,system/composer/*,public/* ./"
]
},
"authors": [
Expand All @@ -28,12 +28,11 @@
}
],
"require": {
"php": "^7.2",
"php": "^7.0",
"ext-openssl": "*"
},
"require-dev": {
"sunra/dbug": "^0.2.1",
"squizlabs/php_codesniffer": "3.*",
"slevomat/coding-standard": "^6.4"
"squizlabs/php_codesniffer": "3.*"
}
}
4 changes: 4 additions & 0 deletions ruleset.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
<?xml version="1.0"?>
<ruleset name="AcmeProject">
<config name="installed_paths" value="../../slevomat/coding-standard"/><!-- relative path from PHPCS source location -->
<arg name="tab-width" value="4"/>
<arg name="encoding" value="utf-8"/>
<arg name="extensions" value="php"/>
<arg name="colors"/>

<rule ref="SlevomatCodingStandard.TypeHints.ParameterTypeHint"/>
<rule ref="SlevomatCodingStandard.TypeHints.PropertyTypeHint"/>
Expand Down
1 change: 0 additions & 1 deletion src/common/controller/commonController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ class CommonController extends Controller

/**
* Returns the 404 error page
*
*/
public function pageNotFound(): void
{
Expand Down
1 change: 0 additions & 1 deletion src/product/controller/productController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ class productController extends Controller

/**
* Product sample page
*
*/
public function samplePage(): void
{
Expand Down
2 changes: 0 additions & 2 deletions src/product/model/productModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ class ProductModel extends Model
{
/**
* Return all products
*
*/
public function getAllProducts(): array
{
Expand All @@ -22,7 +21,6 @@ public function getAllProducts(): array
* Sample function: get product by id
*
* @param int $prod_id product id for searching
*
*/
public function getProductById(int $prod_id): array
{
Expand Down
1 change: 0 additions & 1 deletion src/welcome/controller/welcomeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ class welcomeController extends Controller
/**
* First sample page, returns welcome template
* and uses the Console class as example of how to use it
*
*/
public function index(): void
{
Expand Down
2 changes: 0 additions & 2 deletions system/engine/Autoloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ class AutoLoaderClass

/**
* Register loader with SPL autoloader stack.
*
*/
public function register(): void
{
Expand All @@ -35,7 +34,6 @@ public function register(): void
* @param bool $prepend If true, prepend the base directory to the stack
* instead of appending it; this causes it to be
* searched first rather than last.
*
*/
public function addNamespace(string $prefix, string $base_dir, bool $prepend = false): void
{
Expand Down
2 changes: 0 additions & 2 deletions system/engine/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ public function get($key)

/**
* Set an entry in the container and its identifier
*
*/
public function set(string $key, string $value): void
{
Expand All @@ -45,7 +44,6 @@ public function set(string $key, string $value): void
* It does however mean that `get($id)` will not throw a `NotFoundExceptionInterface`.
*
* @param string $id Identifier of the entry to look for.
*
*/
public function has($key): bool
{
Expand Down
2 changes: 0 additions & 2 deletions system/engine/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ public function parsePath(): array

/**
* Checks wether the file, class and method exist, if not, uses the error controller
*
*/
private function isValidPath($file, $class, $method): bool
{
Expand All @@ -81,7 +80,6 @@ private function isValidPath($file, $class, $method): bool
* controller, class and method associated to that seo url
*
* @param string $url_action seo url to search
*
*/
private function getPathFromSeoUrl(string $url_action): string
{
Expand Down
1 change: 0 additions & 1 deletion system/library/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ class Config
*
* @param string $key name of the key
* @param mix $value value to set
*
*/
public function set(string $key, mix $value = ""): void
{
Expand Down
3 changes: 0 additions & 3 deletions system/library/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ public function query(string $sql_query, array $params = array())

/**
* Get the last id of the inserted value in the database
*
*/
public function getLastId(): int
{
Expand All @@ -73,7 +72,6 @@ public function getLastId(): int

/**
* Initializes the database connections
*
*/
public function initialize(): void
{
Expand All @@ -93,7 +91,6 @@ public function initialize(): void

/**
* Kills the database connection, more info: https://php.net/pdo.connections
*
*/
public function destruct(): void
{
Expand Down
7 changes: 0 additions & 7 deletions system/library/Logger.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ public function __construct($error_log_path, $notice_log_path, $warning_log_path
* @param string $error_string Error description
* @param string $error_file File of the error
* @param string $error_line Line of the error
*
*/
public function myErrorHandler(string $errno, string $error_string, string $error_file, string $error_line): void
{
Expand Down Expand Up @@ -76,7 +75,6 @@ public function myErrorHandler(string $errno, string $error_string, string $erro
* Exception callback
*
* @param object $exception Exception message
*
*/
public function myExceptionHandler(object $exception): void
{
Expand All @@ -94,7 +92,6 @@ public function myExceptionHandler(object $exception): void
* Notice callback
*
* @param string $error_string Notice message
*
*/
public function noticeHandler(string $error_string): void
{
Expand All @@ -107,7 +104,6 @@ public function noticeHandler(string $error_string): void
* Warning handler
*
* @param string $error_string Warning message
*
*/
public function warningHandler(string $error_string): void
{
Expand All @@ -120,7 +116,6 @@ public function warningHandler(string $error_string): void
* Error handler
*
* @param string $error_string Error message
*
*/
public function errorHandler(string $error_string): void
{
Expand All @@ -133,7 +128,6 @@ public function errorHandler(string $error_string): void
* Unknown Error handler
*
* @param string $error_string Unknown error message
*
*/
public function unknownErrorHandler(string $error_string): void
{
Expand All @@ -146,7 +140,6 @@ public function unknownErrorHandler(string $error_string): void
* Checks, wether the file passed in the argument exist, if not, creates it
*
* @param string $file_name path of the log file
*
*/
public function checkLogFile(string $file_name): void
{
Expand Down
3 changes: 0 additions & 3 deletions system/library/Output.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ public function __construct($header_path, $footer_path, $cache_version, $is_debu
*
* @param string $route path of the template to load
* @param string $data array of data to use in the template (if any)
*
*/
public function load(string $route, string $data = array()): void
{
Expand Down Expand Up @@ -68,7 +67,6 @@ public function loadFile(string $route, array $data): string
* Adds a js file at the end of the html document
*
* @param string $js_route path of the js file (without extension)
*
*/
public function addJs(string $js_route): void
{
Expand All @@ -80,7 +78,6 @@ public function addJs(string $js_route): void
* Adds a css file at the end of the html document
*
* @param string $css_route path of the css file (without extension)
*
*/
public function addCss(string $css_route): void
{
Expand Down
6 changes: 0 additions & 6 deletions system/library/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ public function __construct(\SessionHandlerInterface $session_handler, string $s
/**
* Starts the session and checks that it's not empty, and regenerates the id of the session
* with a probability of 1/5
*
*/
public function start(): bool
{
Expand Down Expand Up @@ -85,7 +84,6 @@ public function get(string $name)
*
* @param string $name name of the session index to store the value
* @param string $value value to write into the session $name index
*
*/
public function set(string $name, string $value): void
{
Expand All @@ -104,7 +102,6 @@ public function set(string $name, string $value): void
/**
* Checks if the current session is valid, this means, that it's not expired
* and that the fingerprint, didn't change
*
*/
public function isValid(): bool
{
Expand All @@ -113,7 +110,6 @@ public function isValid(): bool

/**
* Checks wether the clients headers and the remote ip address didn't change
*
*/
public function isFingerprint(): bool
{
Expand All @@ -132,7 +128,6 @@ public function isFingerprint(): bool
* Checks wether the session didn't expire (ttl)
*
* @param int $ttl time to live setting
*
*/
public function isExpired(int $ttl = 30): bool
{
Expand All @@ -148,7 +143,6 @@ public function isExpired(int $ttl = 30): bool

/**
* Deletes and cleans the session
*
*/
public function forget(): bool
{
Expand Down
8 changes: 0 additions & 8 deletions system/library/Util.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ public function arraySortByColumn(array &$arr, $col, $dir = SORT_ASC): array
* Convert the size number into a human readable value
*
* @param int $size size number of memory to convert into a readable value
*
*/
public function convert(int $size): string
{
Expand All @@ -37,7 +36,6 @@ public function convert(int $size): string

/**
* Check if the running HTTP request is started by an AJAX
*
*/
public function isAjaxRequest(): bool
{
Expand All @@ -49,7 +47,6 @@ public function isAjaxRequest(): bool

/**
* Get client's IP address - if proxy lets get the REAL IP address
*
*/
public function ipAddress(): string
{
Expand All @@ -71,7 +68,6 @@ public function ipAddress(): string
* Escapes all the quotes/special characters
*
* @param string $value String to clean all the quotes, break lines and special chars
*
*/
public function escape(string $value): string
{
Expand All @@ -82,7 +78,6 @@ public function escape(string $value): string
* Deletes special characters
*
* @param string $text text to clean special characters
*
*/
public function preventXSS($value): string
{
Expand All @@ -93,7 +88,6 @@ public function preventXSS($value): string
* Generates an simple random token with an specified length
*
* @param int $length length of the token to generate
*
*/
public function generateSimpleToken(int $length): string
{
Expand All @@ -112,7 +106,6 @@ public function generateSimpleToken(int $length): string

/**
* Generates a random token for use in the CSRF token (this is used to check the POST forms integrity)
*
*/
public function generateCSRFToken(): string
{
Expand All @@ -121,7 +114,6 @@ public function generateCSRFToken(): string

/**
* Checks wether the CSRF token used in the POST form, matches with the CSRF token stored in the session
*
*/
public function checkPostCSRFToken(): void
{
Expand Down

0 comments on commit d2a60b3

Please sign in to comment.