PHP code example of rcs_us / framework_core

1. Go to this page and download the library: Download rcs_us/framework_core library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

rcs_us / framework_core example snippets


/**
 * @signal signalWithNoArguments
 * @signal signalWithOneArgument
 * ^-- This is ublic 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 
$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();