rcs_us/framework_core 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

rcs_us/framework_core

Composer 安装命令:

composer require rcs_us/framework_core

包简介

PHP implementation of Qt's signals/slots. This release is for 5.3+ & 7+ as there are namespaces. Please see other version for previous version without namespaces

关键字:

README 文档

README

Based on Qt's implementation of signals/slots ( not asynchronous )

Overview

This release is for 5.3+ & 7+ as there are namespaces. Please see other version for previous version without namespaces.

As with Qt's signals/slots, this package was built to be very light, and work well with existing applications that didn't originally depend on it.

Adding the functionality of this package is simple:

  1. Extend RCS_Core_Object in your existing class(es).
  2. Add @signal declarations to your doc comments for your class.
  3. Add @slot declarations to your doc comments for your functions.

Example

/**
 * @signal signalWithNoArguments
 * @signal signalWithOneArgument
 * ^-- This is required. You will declare all of your signals this way
 */
class Test_Signal_Class extends \RCS\Core\Object
{
    /**
     * 
     */
    public function testFunctionEmittingSignalWithNoArguments ()
    {
        $this->emit( "signalWithNoArguments" );
    }
    
    /**
     * 
     */
    public function testFunctionEmittingSignalWithOneArgument ()
    {
        $this->emit( "signalWithOneArgument", new Test_Model_Class() );
    }
    
}

class Test_Slot_Class extends \RCS\Core\Object
{
    /**
     *
     * @slot
     * ^-- This is required to declare the function as a slot
     */
    public function testSlotForSignalWithNoArguments ()
    {
        print "Got to " . __METHOD__ . "<br />\n";
    }
    
    /**
     *
     * @slot
     * ^-- This is required to declare the function as a slot
     */
    public function testSlotForSignalWithOneArgument ( Test_Model_Class $testModelClass )
    {
        // var_dump(debug_backtrace());
        print "Got to " . __METHOD__ . "<br />\n";
        print_r($testModelClass);
    }
}

class Test_Model_Class {}

$testSignalClass = new Test_Signal_Class();
$testSlotClass = new Test_Slot_Class();

// This is the ideal way to implement the library
\RCS\Core\Object::connect($testSignalClass, "signalWithNoArguments", $testSlotClass, "testSlotForSignalWithNoArguments");
\RCS\Core\Object::connect($testSignalClass, "signalWithOneArgument", $testSlotClass, "testSlotForSignalWithOneArgument");

// This can be used in cases where the original code implementation was done very poorly, 
// or possibly encoded into a package such as Zend Guard or a PHP extension where you can't access the source directly
\RCS\Core\Object::connectByName("Test_Signal_Class", "signalWithOneArgument", $testSlotClass, "testSlotForSignalWithOneArgument");

// This has just one connection
$testSignalClass->testFunctionEmittingSignalWithNoArguments();

// This has two connections
$testSignalClass->testFunctionEmittingSignalWithOneArgument();

The above code will result in the following output:

Got to Test_Slot_Class::testSlotForSignalWithNoArguments<br />
Got to Test_Slot_Class::testSlotForSignalWithOneArgument<br />
Test_Model_Class Object
(
)
Got to Test_Slot_Class::testSlotForSignalWithOneArgument<br />
Test_Model_Class Object
(
)

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-01-07

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固