This file contains hidden or 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 | |
/** | |
* @param string $string Subject | |
* @param int $length Max string length | |
* @param bool $exactLength Truncate string with exact $length | |
* @param string $append Ellipsis string | |
* @return string | |
*/ | |
class TruncateString |
This file contains hidden or 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 InMemoryCache | |
{ | |
public $size = 10; | |
protected $cache = []; | |
/** | |
* @param string $key |
This file contains hidden or 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 AsteriskMatch | |
{ | |
/** | |
* @param string $mask string with asterisk | |
* @param string $string tested subject | |
* @return bool | |
* @throws \Exception | |
*/ |
This file contains hidden or 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 console\components; | |
use Throwable; | |
use yii\base\Action; | |
class CronException extends \RuntimeException | |
{ | |
/** |
This file contains hidden or 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 tests\codeception\common\unit; | |
use Codeception\Specify; | |
use yii\di\Instance; | |
use yii\test\InitDbFixture; | |
/** | |
* usage: |
This file contains hidden or 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 console\components; | |
class XMLReader extends \XMLReader | |
{ | |
/** | |
* @param string $nodeName | |
* @return $this |
This file contains hidden or 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 | |
# Algorithm found here: http://www.hackerfactor.com/blog/index.php?/archives/432-Looks-Like-It.html | |
class HashBuilder | |
{ | |
private $buf; | |
function __construct() | |
{ | |
$this->buf = imagecreatetruecolor(8, 8); | |
} |
This file contains hidden or 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 common\ActiveRecordTrait; | |
use yii\db\ActiveQuery; | |
use yii\db\ActiveRecord; | |
trait WithoutTrait | |
{ |
This file contains hidden or 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 common\traits; | |
trait FindOrCreate | |
{ | |
/** | |
* @param mixed $key Primary key or array with condition for \yii\db\Query::where(condition) | |
* @return static | |
* @throws \Exception |
This file contains hidden or 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 common\exception; | |
use e96\sentry\ErrorHandler; | |
use yii\base\Exception; | |
use yii\db\ActiveRecord; | |
class CantSave extends Exception |