This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Utils; | |
class Validator { | |
const IS_URL = 1; | |
const IN_ARRAY = 2; | |
//other constants | |
public static function validate($fields) { | |
foreach ($fields as $f) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// DIC configuration | |
$container = $app->getContainer(); | |
$container['renderer'] = function ($c) { | |
$settings = $c->get('settings')['renderer']; | |
return new \Renderers\PugRenderer($settings); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//An elegant way to read CSV data in PHP. | |
//Tested with PHP7 | |
//BTW, you can quickly generate some test data at https://www.mockaroo.com/ | |
error_reporting(-1); | |
const CSV_FILE = "data.csv"; | |
const CSV_MAP = array( | |
'serial', | |
'first-name', | |
'last-name' |