1. Go to this page and download the library: Download elegant-bro/interfaces 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/ */
elegant-bro / interfaces example snippets
declare(strict_types=1);
use ElegantBro\Interfaces\Stringify;
final class MyStringify implements Stringify
{
/**
* @return string
* @throws Exception
*/
public function asString(): string
{
return "Hello World";
}
}
declare(strict_types=1);
use ElegantBro\Interfaces\Numeric;
final class MyNumeric implements Numeric
{
/**
* @return string
* @throws Exception
*/
public function asNumber(): string
{
return "5";
}
}
declare(strict_types=1);
use ElegantBro\Interfaces\Iteratee;
final class MyIteratee implements Iteratee
{
/**
* @return Iterator
* @throws Exception
*/
public function asIterator(): Iterator
{
yield 'foo';
yield 'bar';
}
}
declare(strict_types=1);
use ElegantBro\Interfaces\Arrayee;
final class MyArrayee implements Arrayee
{
/**
* @return array
* @throws Exception
*/
public function asArray(): array
{
return [1, 2, 3];
}
}
declare(strict_types=1);
use ElegantBro\Interfaces\Predicate;
final class Odd implements Predicate
{
/**
* @var int
*/
private $val;
public function __construct(int $val)
{
$this->val = $val;
}
public function asBool() : bool
{
return 0 !== $this->val % 2;
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.