Skip to content

Instantly share code, notes, and snippets.

View amaelftah's full-sized avatar

Ahmed Mohamed Abd El Ftah amaelftah

View GitHub Profile
@amaelftah
amaelftah / blacklist-names.php
Created September 22, 2017 14:02
in_array() instead of multiple or conditions
<?php
function isBlacklisted($name)
{
if ($name == 'ahmed' || $name == 'mohamed' || $name == 'ali' || $name == 'khaled' || $name == 'ayman')
{
return true;
}
return false;
@amaelftah
amaelftah / conditional-function.php
Last active July 14, 2018 11:49
extracting conditions to meaningful functions
<?php
if (
$employee['age'] < '40'
&& $employee['medical_health'] == 'healthy'
&& $employee ['work_happits'] != 'bad'
)
{
// do somethings
@amaelftah
amaelftah / RealTimeFacade.php
Last active October 4, 2017 21:25
Real Time Facade
<?php
use App\Services\ShareService;
class Post extends Model
{
public function share(ShareService $shareService)
{
$shareService->shareOnFacebook($this);
}
@amaelftah
amaelftah / .php_cs
Last active March 11, 2021 13:10
PHP-CS-Fixer Version 2 Config Based On Laravel
<?php
/**
* Author : Ahmed Mohamed Abd El Ftah
*
* Twitter : @amaelftah
*
* Github: https://github.com/amaelftah
*/