2017 © Pedro Peláez
 

library pdecorate

Python like function decoration in PHP

image

zhikiri/pdecorate

Python like function decoration in PHP

  • Monday, January 22, 2018
  • by zhikiri
  • Repository
  • 1 Watchers
  • 1 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 9 Versions
  • 0 % Grown

The README.md

pdecorate

CircleCI, (*1)

Simulation of the Python decorators in PHP, (*2)

Install with composer: composer require zhikiri/pdecorate, (*3)

Description

Creation of the new decorator, second parameter must be callable., (*4)

Allow to use class methods, function names and Closure class instances (anonymous function), (*5)

Pdecorate::add('italic', function ($content) {
  return "<i>{$content}</i>";
});

Get instance of the decoration, (*6)

First of all pass the decorators and the last parameter must be the callable function., (*7)

$decoration = new Decorator(
    'italic',
    function () {
        return 'decoration text';
    }
);

Decoration execution: - cast to string (string)$decoration - execute the Decorator instance $decoration() - run the Decorator call method $decoration->call(), (*8)

Result of the current decoration will be: <i>decoration text</i>, (*9)

The Versions

22/01 2018

dev-master

9999999-dev

Python like function decoration in PHP

  Sources   Download

MIT

The Development Requires

by Avatar zhikiri

22/01 2018

v2.0.2

2.0.2.0

Python like function decoration in PHP

  Sources   Download

MIT

The Development Requires

by Avatar zhikiri

22/01 2018

dev-develop

dev-develop

Python like function decoration in PHP

  Sources   Download

MIT

The Development Requires

by Avatar zhikiri

22/01 2018

v2.0.1

2.0.1.0

Python like function decoration in PHP

  Sources   Download

Apache-2

The Development Requires

by Avatar zhikiri

22/01 2018

v2.0.0

2.0.0.0

Python like function decoration in PHP

  Sources   Download

Apache-2

The Development Requires

by Avatar zhikiri

09/01 2016

v1.1.0

1.1.0.0

Simulate Python decorators in PHP

  Sources   Download

Apache-2.0

The Development Requires

by Zhivitsa Kirill

20/12 2015

v1.0.2

1.0.2.0

Simulate Python decorators in PHP

  Sources   Download

Apache-2.0

The Development Requires

by Zhivitsa Kirill

19/12 2015

v1.0.1

1.0.1.0

Simulate Python decorators in PHP

  Sources   Download

Apache-2.0

The Development Requires

by Zhivitsa Kirill

19/12 2015

v1.0.0

1.0.0.0

Simulate Python decorators in PHP

  Sources   Download

Apache-2.0

The Requires

 

by Zhivitsa Kirill