承接 thinframe/foundation 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

thinframe/foundation

Composer 安装命令:

composer require thinframe/foundation

包简介

A collection of classes that make the foundation of all ThinFrame components

README 文档

README

#ThinFrame Foundation

Is a collection of classes that make the foundation of all ThinFrame components.

Build Status Latest Stable Version Latest Unstable Version License

##Index

  1. TypeCheck
  2. AbstractEnum

TypeCheck

TypeHinting for primary types

Sample usage:

<?php
use ThinFrame\Foundation\Constant\DataType;
use ThinFrame\Foundation\Helper\TypeCheck;

function myAwesomeFunction($stringVariable, \Exception $exception, $boolVariable)
{
    //if any of the above arguments doesn't respect the type an invalid argument exception will be thrown
    TypeCheck::doCheck(DataType::STRING, DataType::SKIP, DataType::BOOLEAN);
}

If any of the function arguments doesn't match the given type, and InvalidArgumentException will be thrown. Argument types are specified in order of the declaration (check ThinFrame\Foundation\Constants\DataType for possible data types. DataType::SKIP is used to skip the validation of a argument.

AbstractEnum

Enum implementation for PHP. An enumeration is defined using constants and it also can be instantiated.

<?php
use ThinFrame\Foundation\DataType\AbstractEnum;

class WeekDay extends AbstractEnum
{
    const MONDAY    = 1;
    const TUESDAY   = 2;
    const WEDNESDAY = 3;
    const THURSDAY  = 4;
    const FRIDAY    = 5;
    const SATURDAY  = 6;
    const SUNDAY    = 7;
}

//constructor will accept only valid enum values
$weekDay = new WeekDay(WeekDay::SUNDAY);

$weekDay->equals(WeekDay::SUNDAY); // true
$weekDay->equals(WeekDay::MONDAY); // false (captain obvious)

WeekDay::getMap(); //Map with enum key=>value pairs

WeekDay::isValid(5); //true
WeekDay::isValid(9); //false

WeekDay::type(); //callback that will validate a given enum value. Used for TypeCheck

###Installation:

  • via Composer: "thinframe/foundation":"0.3.*"

###Contribuitors

###License

  • MIT

统计信息

  • 总下载量: 10.27k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 10
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2013-11-11

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固