netsilik/enum
Composer 安装命令:
composer require netsilik/enum
包简介
Strict Enumeration class.
关键字:
README 文档
README
Strict Enumeration class.
MIT Licence
Unless required by applicable law or agreed to in writing, software distributed under the Licence is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Contact: info@netsilik.nl
Latest version available at: https://gitlab.com/Netsilik/Enum
Example of usage
// Object creation
final class Species extends Enum {
protected $enum = array('human','monkey','alien');
}
// Use Enum
function checkSpecies(Species $enum) {
return ($enum <> 'alien') ? 'Hello' : 'Waaah!';
}
checkSpecies(new Species('monkey')); // returns 'Hello'
// Use Enum with invalid value
function checkSpecies(Species $enum) {
return ($enum <> 'alien') ? 'Hello' : 'Waaah!';
}
checkSpecies(new Species('lion')); // triggers Fatal Error: 'Provided value is not part of this enumerated list'
Installation
composer require netsilik/enum
统计信息
- 总下载量: 1.64k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-06-05