for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Ffcms\Core\Traits;
/**
* Assistance tools for fast using some magical things and opportunity of classic object-oriented programming
*/
trait ClassTools
{
* Create hash string from current class properties and itself values.
* This method is good stuff for caching dynamic instances
* @return string|null
public function createStringClassSnapshotHash()
$hash = null;
foreach ($this as $property => $value) {
$hash = md5($hash . $property . '=' . $value);
}
return $hash;
* Get method required arguments count
* @param $class
* @param string $method
* @return int
public function getMethodRequiredArgCount($class, string $method): int
$instance = new \ReflectionMethod($class, $method);
$count = 0;
// calculate method defined arguments count
foreach ($instance->getParameters() as $arg) {
if (!$arg->isOptional()) {
$count++;
return $count;