SkillAgentSearch skills...

Mimic

Dead simple functional library for object prototyping, data hydration and data exposition

Install / Use

/learn @keyvanakbary/Mimic
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

Mimic

Build Status

Dead simple functional library for object prototyping, data hydration and data exposition.

Installation

composer require keyvanakbary/mimic

Usage

namespace Domain;

use mimic as m;

class ComputerScientist {
    private $name;
    private $surname;
    
    public function __construct($name, $surname) {
        $this->name = $name;
        $this->surname = $surname;
    }
    
    public function rocks() {
        return $this->name . ' ' . $this->surname . ' rocks!';
    }
}

assert(m\prototype('Domain\ComputerScientist') instanceof Domain\ComputerScientist);

m\hydrate('Domain\ComputerScientist', array(
    'name' => 'John',
    'surname' => 'McCarthy'
))->rocks(); //John McCarthy rocks!

assert(m\expose(new Domain\ComputerScientist('Grace', 'Hopper')) == array(
    'name' => 'Grace',
    'surname' => 'Hopper'
));
View on GitHub
GitHub Stars21
CategoryDevelopment
Updated1y ago
Forks2

Languages

PHP

Security Score

80/100

Audited on Apr 9, 2024

No findings