2017 © Pedro Peláez
 

library contracts

Code generating tool

image

perfumer/contracts

Code generating tool

  • Thursday, June 21, 2018
  • by blumfontein
  • Repository
  • 0 Watchers
  • 0 Stars
  • 178 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 17 Versions
  • 2 % Grown

The README.md

Barman is a tool for generating php classes. It uses zend-code to generate class and Doctrine Annotations to add annotations which mutate class and method generators in needed way., (*1)

Barman provides DSL (based on annotations) to describe method execution order and generate unit tests., (*2)

Built-in annotations

  • Alias - replaces string variables in method scope with Variable Annotations
  • Context - defines context class or call context object if used as Step
  • Custom - defines call of custom method in contract class
  • Error - call method of Context if validation fails
  • Inject - replaces string variables with Variable Annotations (placed in Context method Annotation scope)
  • Injection - defines injected class or primitive or call injected object if used as Step
  • Output - this variable will be returned by method
  • Property - use class property as variable
  • ServiceObject - call method of object in method scope (i.e. $some_object->someMethod())
  • ServiceParent - call method of parent class (i.e. parent::someMethod())
  • ServiceProperty - call method of class property (i.e. $this->some_property->someMethod())
  • ServiceSelf - call static method of the class (i.e. self::someMethod())
  • ServiceStatic - call static method of some class (i.e. SomeClass::someMethod())
  • ServiceThis - call method from the class (i.e. $this->someMethod())
  • Test - generate unit test for this method

Annotation fields

  • Alias
    • name {string} - name of variable in scope
    • variable {Annotation} - object annotation that will replace a variable
  • Context (extends Step)
    • name {string} - short name of the context
    • class {string} - fully qualified name of the class
  • Custom (extends Step)
  • Error (extends Context)
  • Inject
    • name {string} - name of argument in Context method
    • variable {Annotation} - object annotation that will replace an argument
  • Injection (extends Step)
    • name {string} - short name of the injection
    • type {string} - fully qualified name of the class or primitive type
  • Output
  • Property
    • name {string} - name of class property
  • ServiceObject (extends Step)
    • name {string} - name of object in scope
  • ServiceParent (extends Step)
  • ServiceProperty (extends Step)
    • name {string} - name of class property
  • ServiceSelf (extends Step)
  • ServiceStatic (extends Step)
    • name {string} - fully qualified name of the class
  • ServiceThis (extends Step)
  • Step
    • method {string} - name of method of the called object
    • arguments {array} - arguments passed to method
    • return {string|array} - returned variable names
    • if {string} - step proceeds, if this is true
    • unless {string} - step proceeds, if this is false
  • Test

Lifecycle (creating own annotations)

  • Generators are set to class annotations.
  • onCreate() is called on class annotations.
  • Class annotations implemented ClassAnnotationMutator mutate class annotations.
  • onMutate() is called on class annotations.
  • Generators are set to method annotations.
  • onCreate() is called on method annotations.
  • Class annotations implemented MethodAnnotationMutator mutate method annotations.
  • Method annotations implemented MethodAnnotationMutator mutate method annotations.
  • onMutate() is called on method annotations.
  • Method annotations implemented StepGeneratorMutator mutate step generators.
  • Class annotations implemented StepGeneratorMutator mutate step generators.
  • Class annotations implemented MethodGeneratorMutator mutate method generators.

The Versions

21/06 2018

dev-master

9999999-dev https://github.com/barmanlabs/php

Code generating tool

  Sources   Download

MIT

The Requires

 

by Ilyas Makashev

generator

08/05 2017

v0.13.1

0.13.1.0 https://github.com/perfumer/contracts

Code generating tool

  Sources   Download

MIT

The Requires

 

by Ilyas Makashev

generator

08/05 2017

v0.13.0

0.13.0.0 https://github.com/perfumer/contracts

Code generating tool

  Sources   Download

MIT

The Requires

 

by Ilyas Makashev

generator

01/05 2017

v0.12.0

0.12.0.0 https://github.com/perfumer/contracts

Code generating tool

  Sources   Download

MIT

The Requires

 

by Ilyas Makashev

generator

27/04 2017

v0.11.1

0.11.1.0 https://github.com/perfumer/contracts

Code generating tool

  Sources   Download

MIT

The Requires

 

by Ilyas Makashev

generator

23/04 2017

v0.11.0

0.11.0.0 https://github.com/perfumer/contracts

Code generating tool

  Sources   Download

MIT

The Requires

 

by Ilyas Makashev

generator

16/04 2017

v0.10.0

0.10.0.0 https://github.com/perfumer/contracts

Code generating tool

  Sources   Download

MIT

The Requires

 

by Ilyas Makashev

generator

09/04 2017

v0.9.0

0.9.0.0 https://github.com/perfumer/contracts

Code generating tool

  Sources   Download

MIT

The Requires

 

by Ilyas Makashev

generator

03/04 2017

v0.8.1

0.8.1.0 https://github.com/perfumer/contracts

Code generating tool

  Sources   Download

MIT

The Requires

 

by Ilyas Makashev

generator

02/04 2017

v0.8.0

0.8.0.0 https://github.com/perfumer/contracts

Code generating tool

  Sources   Download

MIT

The Requires

 

by Ilyas Makashev

generator

24/03 2017

v0.7.0

0.7.0.0 https://github.com/perfumer/contracts

Code generating tool

  Sources   Download

MIT

The Requires

 

by Ilyas Makashev

generator

21/03 2017

v0.6.0

0.6.0.0 https://github.com/perfumer/contracts

Code generating tool

  Sources   Download

MIT

The Requires

 

by Ilyas Makashev

generator

04/03 2017

v0.5.0

0.5.0.0 https://github.com/perfumer/bdd

BDD generating tool

  Sources   Download

MIT

The Requires

 

by Ilyas Makashev

bdd generator

24/02 2017

v0.4.0

0.4.0.0 https://github.com/perfumer/bdd

BDD generating tool

  Sources   Download

MIT

The Requires

 

by Ilyas Makashev

bdd generator

20/02 2017

v0.3.0

0.3.0.0 https://github.com/perfumer/bdd

BDD generating tool

  Sources   Download

MIT

The Requires

 

by Ilyas Makashev

bdd generator

05/02 2017

v0.2.0

0.2.0.0 https://github.com/perfumer/bdd

BDD generating tool

  Sources   Download

MIT

The Requires

 

by Ilyas Makashev

bdd generator

21/01 2017

v0.1.0

0.1.0.0 https://github.com/perfumer/bdd

BDD generating tool

  Sources   Download

MIT

The Requires

 

by Ilyas Makashev

bdd generator