jmversteeg/contextual

简单的面向对象上下文

1.3.0 2016-07-04 15:53 UTC

This package is not auto-updated.

Last update: 2024-09-28 17:31:21 UTC


README

简单的面向对象上下文

Build Status Code Quality Code Coverage Packagist Version

使用说明

/**
 * @property boolean $JSON
 * @property boolean $admin
 * @property string  $type
 */
class ResponseContext extends \jmversteeg\contextual\Context
{

    // Declare default values with a preceding underscore
    
    private $_JSON  = false;
    private $_admin = false;
    private $_type  = 'body';

}

$responseContext = new ResponseContext([
    'JSON' => true,
    'type' => 'ajax'
]);

$responseContext->JSON;
// => true
$responseContext->admin;
// => false

$subContext = $responseContext->createSubContext([
    'admin' => true
]);

$subContext->JSON;
// => true
$subContext->admin;
// => true

许可证

MIT © JM Versteeg