elegant-bro/interfaces
最新稳定版本:1.2.0
Composer 安装命令:
composer require elegant-bro/interfaces
包简介
README 文档
README
Make your objects elegant
Installation
composer require elegant-bro/interfaces
Basic usage
<?php declare(strict_types=1); use ElegantBro\Interfaces\Stringify; final class MyStringify implements Stringify { /** * @return string * @throws Exception */ public function asString(): string { return "Hello World"; } }
<?php declare(strict_types=1); use ElegantBro\Interfaces\Numeric; final class MyNumeric implements Numeric { /** * @return string * @throws Exception */ public function asNumber(): string { return "5"; } }
<?php declare(strict_types=1); use ElegantBro\Interfaces\Iteratee; final class MyIteratee implements Iteratee { /** * @return Iterator * @throws Exception */ public function asIterator(): Iterator { yield 'foo'; yield 'bar'; } }
<?php declare(strict_types=1); use ElegantBro\Interfaces\Arrayee; final class MyArrayee implements Arrayee { /** * @return array * @throws Exception */ public function asArray(): array { return [1, 2, 3]; } }
<?php declare(strict_types=1); use ElegantBro\Interfaces\Predicate; final class Odd implements Predicate { /** * @var int */ private $val; public function __construct(int $val) { $this->val = $val; } public function asBool() : bool { return 0 !== $this->val % 2; } }
统计信息
- 总下载量: 4.19k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 0
- 依赖项目数: 7
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-09-10