PHP code example of ndj888 / com_jjcbs_tool

1. Go to this page and download the library: Download ndj888/com_jjcbs_tool 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/ */

    

ndj888 / com_jjcbs_tool example snippets


    namespace com_jjcbs\lib\annotation;
    
    
    use com_jjcbs\exceptions\AnnotationException;
    use com_jjcbs\fun\AnnotationFun;
    use com_jjcbs\lib\AnnotationMethodAbstract;
    
    /**
     * format of type json serialize
     * Class OutPutFormat
     * @package com_jjcbs\lib\annotation
     */
    class OutPutFormat extends AnnotationMethodAbstract
    {
        static protected function parsedMethod($data = null)
        {
            // TODO: Implement parsedMethod() method.
            self::parseMethodExec($data);
        }
    
        static protected function parsedClass($data = null)
        {
            // TODO: Implement parsedClass() method.
            return 'disable';
        }
    
        static protected function parsedVar($data = null)
        {
            // TODO: Implement parsedVar() method.
            $getterStr = AnnotationFun::createGetterByVar(self::$argv['varName'] , $data);
            self::$input = str_replace('//{{annotation placeholder}}' , $getterStr , self::$input);
        }
    
        static protected function do()
        {
            // TODO: Implement do() method.
            switch (self::$param['type']){
                case 'json':
                    if(isset(self::$argv['varName'])) return sprintf('return json_decode($this->%s , true);' , self::$argv['varName']);
                    if(isset(self::$argv['methodName'])) return 'return json_decode(%s , true)';
                    break;
                default:break;
    
            }
        }
    
        static protected function exception(AnnotationException $exception)
        {
            // TODO: Implement exception() method.
            // no thing
            return ;
        }
    
    
    }
$xslt

    /**
     * @@OutPutFormat(type="json")
     * @return array
     */
    public function getJson(){
        return $this->getArr();
    }

    /**
     * @@OutPutFormat(type="json")
     * @return array
     */
    public function getJson(){
        return $this->getArr();
    }