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 | |
/** @noinspection ? */ | |
// PhpUndefinedGotoLabelInspection Undefined goto label | |
// PhpUndefinedVariableInspection Undefined variable | |
// PhpUndefinedMethodInspection Undefined method | |
// PhpUndefinedNamespaceInspection Undefined namespace | |
// PhpUndefinedClassInspection Undefined class | |
// PhpUndefinedFunctionInspection Undefined function |
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
/** | |
* You may use this function with both 2 or 3 interval colors for your gradient. | |
* For example, you want to have a gradient between Bootstrap's danger-warning-success colors. | |
*/ | |
function colorGradient(fadeFraction, rgbColor1, rgbColor2, rgbColor3) { | |
var color1 = rgbColor1; | |
var color2 = rgbColor2; | |
var fade = fadeFraction; | |
// Do we have 3 colors for the gradient? Need to adjust the params. |
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 YourApp\Repository\Query; | |
use Doctrine\DBAL\Connection; | |
use Doctrine\DBAL\Schema\Identifier; | |
/** | |
* Class BulkInsertQuery | |
* |
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 an integer number to a word in Lithuanian language. | |
* | |
* @param int $number Integer number to be converted into words | |
* @param array|bool $units Units array like array(0 => šimtas, 1 => šimtai, 2 => šimtų); | |
* @param bool $one If false, word "vienas" is omitted | |
* @return string | |
*/ |
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 | |
class Db | |
{ | |
public function batchInsert($table, array $rows, array $columns = array()) | |
{ | |
// Is array empty? Nothing to insert! | |
if (empty($rows)) { | |
return true; | |
} |
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 Iterator; | |
use ArrayIterator; | |
use Iterator; | |
/** | |
* Takes a set of iterators [iterator1, iterator2, iterator3, ...] | |
* and iterates in an equivalent way to: |
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 Vrt\UtilsBundle\Service; | |
use RuntimeException; | |
use Symfony\Component\DependencyInjection\Container; | |
// AppKernel::initializeContainer() | |
// if ('dev' === $this->environment) { | |
// ContainerServiceId::setContainer($this->container); |
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 | |
class PermutationIterator implements Iterator | |
{ | |
/** @var array */ | |
protected $items; | |
/** @var int */ | |
protected $slots; |
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 | |
// Trims whitespaces after any tags. Assumes that a tag ends with '/>', '\w>', '">'. | |
$html = preg_replace('#(["|\/|\w]>)(\s+)#', '$1', $html); | |
// Trims whitespaces before any tags. Assumes that tags start with '<\w+' | |
$html = preg_replace('#(\s+)(<\/?\w+)#', '$2', $html); | |
// Trims spaces between tags (both opening and closing). | |
// Assumes that a tag ends with '/>', '\w>', '">' and starts with '<\w+' |
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 | |
use PHPUnit\Framework\TestCase; | |
class CloneTest extends TestCase | |
{ | |
/** | |
* @dataProvider testClone | |
* | |
* @param object $obj0 |
NewerOlder