Skip to content

Instantly share code, notes, and snippets.

View matej21's full-sized avatar

David Matějka matej21

View GitHub Profile
@matej21
matej21 / BasePresenter.php
Last active March 14, 2024 08:32
Backlink
<?php
/** @var string @persistent */
public $_backlink;
public function link($destination, $args = [])
{
$modifiers = [];
if (($pos = strrpos($destination, ')')) !== FALSE) {
$modifiers = array_fill_keys(explode(')(', substr($destination, 1, $pos - 1)), TRUE);
$destination = substr($destination, $pos + 1);
<?php
protected function resetPersistentParameters($args)
{
$rc = new Nette\Application\UI\PresenterComponentReflection($this);
$propertyValues = $rc->getDefaultProperties();
foreach ($rc->getPersistentParams() as $param => $def) {
if (!array_key_exists($param, $args) && array_key_exists($param, $propertyValues)) {
$args[$param] = $propertyValues[$param];
}
}
<?php
class ContentResponse extends \Nette\Object implements \Nette\Application\IResponse
{
protected $forDownload = FALSE;
/** @var string */
private $file;
/** @var string */
<?php declare(strict_types = 1);
namespace App\Core\Orm;
use MabeEnum\Enum;
use Nextras\Orm\Entity\IEntity;
use Nextras\Orm\Entity\IPropertyContainer;
use Nextras\Orm\Entity\Reflection\PropertyMetadata;
<?php declare(strict_types = 1);
namespace AppTests\PhpStan\NextrasOrm;
use Nextras\Orm\Entity\Entity;
use PhpParser\Node;
use PhpParser\Node\Expr\MethodCall;
use PHPStan\Analyser\Scope;
use PHPStan\Broker\Broker;
use PHPStan\Rules\Rule;
<?php declare(strict_types = 1);
namespace App\Core\Latte;
use App\ImplementationException;
use Latte\Compiler;
use Latte\MacroNode;
use Latte\Macros\MacroSet;
use Latte\PhpWriter;
@matej21
matej21 / a.php
Last active February 1, 2017 13:46
<?php
$a = 1;
var_dump($a); //prints 2
<?php
use Nette\Application\IRouter;
use Nette\Application\UI\InvalidLinkException;
use Nette\Application\UI\Presenter;
use Nette\Application;
use Nette\Http\Url;
use Nette\Object;
/**
- Praha: http://srazy.info/nettefwpivo
- Brno: http://srazy.info/nettefwbrnopivo
- České Budějovice: http://srazy.info/nettefwcbpivo
- Smilovice: http://srazy.info/nettefwsmilovicepivo
- Plzeň: http://srazy.info/nettefwplzenpivo
- Hradec Králové: http://srazy.info/nettehkpivo
- Chrudim: http://srazy.info/nettefwchrudimpivo
- Pardubice: http://srazy.info/nettefwpardubicepivo
.highlight, .blob-code {
tab-size: 4 !important;
}
.repo-list .repo-list-item {
padding-top: 3px;
padding-bottom: 5px;
}
.repo-list .repo-list-meta {