RushCode/m1-api

View on GitHub
src/Abstracts/CallbackMethods.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php

namespace leocata\M1\Abstracts;

abstract class CallbackMethods
{
    /**
     * Import data from json string.
     *
     * @param $data \stdClass
     */
    final public function import(\stdClass $data)
    {
        foreach ($data as $key => $value) {
            $this->$key = $value;
        }
    }

    final public function getMethodName(): string
    {
        return ucfirst((new \ReflectionClass($this))->getShortName());
    }
}