This file contains 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 | |
$a = new A(); | |
$reflection = new \ReflectionClass($a); | |
$property = $reflection->getProperty('privateProperty'); | |
$property->setAccessible(true); | |
$property->setValue($a, 'new-value'); | |
echo $a->getPrivateProperty(); | |
//outputs: |
This file contains 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 | |
// original source: http://kuwamoto.org/2007/12/17/improved-pluralizing-in-php-actionscript-and-ror/ | |
/* | |
The MIT License (MIT) | |
Copyright (c) 2015 | |
Permission is hereby granted, free of charge, to any person obtaining a copy |
This file contains 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 | |
error_reporting(E_ALL); | |
/* Get the port for the service. */ | |
$port = "9100"; | |
/* Get the IP address for the target host. */ | |
$host = "172.17.144.89"; | |
/* construct the label */ |
This file contains 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 Namespace\MyBundle\Repository\Filters; | |
use Doctrine\ORM\Mapping\ClassMetaData; | |
use Doctrine\ORM\Query\Filter\SQLFilter; | |
class DeletedFilter extends SQLFilter | |
{ | |
public function addFilterConstraint(ClassMetadata $targetEntity, $targetTableAlias) | |
{ |
This file contains 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 App\Extensions; | |
// we have an Eloquent model that allows using the session table with the querybuilder methods and eloquent fluent interface- read only! | |
use App\Session; | |
// use the provided database session handler to avoid too much duplicated effort. | |
use Illuminate\Session\DatabaseSessionHandler; | |
class AppDatabaseSessionHandler extends DatabaseSessionHandler |
This file contains 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 | |
/** | |
* Converts integer to Roman. | |
* | |
* @param int $integer | |
* Integer to be converted to Roman string. | |
* | |
* @return string | |
*/ | |
public function integerToRoman($integer) { |
This file contains 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
export function createElement(tag, props, ...children) { | |
const element = document.createElement(tag); | |
if (props) { | |
Object.entries(props).forEach(([key, value]) => { | |
if (key.startsWith('on') && typeof value === 'function') { | |
element.addEventListener(key.substring(2), value); | |
} else if (key.startsWith('data-')) { | |
element.setAttribute(key, value); | |
} else { |