Skip to content

Instantly share code, notes, and snippets.

Avatar

Ahmed Mohamed Abd El Ftah amaelftah

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