2017 © Pedro Peláez
 

library overload

Package for overload in php

image

shindakioku/overload

Package for overload in php

  • Friday, August 18, 2017
  • by Shinda Kioku
  • Repository
  • 0 Watchers
  • 1 Stars
  • 1 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Класс который делает немного магии

Класс позволяет Вам использовать перегрузку методов (ad hoc) на 40%., (*1)

Почему 40? В пхп не разрешено объявлять методы с одинаковыми именами., (*2)

Использование класса:, (*3)

class Bar {}

class Foo
{
    public function withoutArguments(): string
    {
        return 'string';
    }

    public function argument1(string $name): string
    {
        return $name;
    }

    public function argument2(int $number): int
    {
        return $number;
    }

    public function withObject(Bar $bar): Bar
    {
        return $bar;
    }
}

$overload = new Overload\Overload(
    new Overload\OverloadClass(Foo::class), 'argument1', 'argument2'
);

$overload->call('shinda'); // argument1
$overload->call(2); // argument2

$bar = (new Overload\Overload(
    new Overload\OverloadClass(Foo::class), 'withObject'
))->call(new Bar); // $bar = Bar object;

(new Overload\Overload(
        new Overload\OverloadClass(Foo::class), 'withoutArguments'
    ))->call(); // 'string'

The Versions

18/08 2017

dev-master

9999999-dev

Package for overload in php

  Sources   Download

MIT

The Requires

 

by ShindaKioku

03/07 2017

1.0.0

1.0.0.0

Package for overload in php

  Sources   Download

MIT

The Requires

 

by ShindaKioku