sgolemon/table-flip
Composer 安装命令:
composer require sgolemon/table-flip
包简介
Essential exception class needed by every good project.
README 文档
README
Inspired by Adam Harvey: https://twitter.com/LGnome/status/735573024825430016
if ($situation === SHIT::HAPPENED) {(╯°□°)╯︵┻━┻(); }
Usages:
- throw new (╯°□°)╯︵┻━┻; // TableFlip
- throw new (ノ゜Д゜)ノ︵┻━┻; // PudgyTableFlip
- throw new (ノಥ益ಥ)ノ︵┻━┻; // AgroTableFlip
- (╯°□°)╯︵┻━┻(); // Function shorthand
- assert((╯°□°)╯︵┻━┻() ); // Use in an assert to only flip in dev
All three table-flip classes extend \Exception and implement the ┻━┻ interface, so the following works:
try {
$ret = doSomething();
if ($ret === null) {
throw new (╯°□°)╯︵┻━┻;
} elseif ($ret === false) {
throw new (ノಥ益ಥ)ノ︵┻━┻;
} elseif (!is_string($ret)) {
throw new (ノ゜Д゜)ノ︵┻━┻;
}
} catch (┻━┻ $e) {
┬─┬ノ(・_・ノ);
}
Note that the parentheses used in the class/function names here are U+FF08 FULLWIDTH LEFT PARENTHESIS and U+FF09 FULLWIDTH RIGHT PARENTHESIS since normal parens (U+0028/U+0029) are not allowed in PHP labels.
Similarly, the customary space is omitted entirely to make this a valid PHP label.
统计信息
- 总下载量: 3.53k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 341
- 点击次数: 6
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: Public
- 更新时间: 2016-05-26