<?php
namespace Packagist\Api\Result;
use Doctrine\Common\Inflector\Inflector;
use Doctrine\Inflector\InflectorFactory;
abstract class AbstractResult
{
/**
* @param array $data
*/
public function fromArray(array $data)
{
$inflector = \class_exists(InflectorFactory::class) ? InflectorFactory::create()->build() : null;
foreach ($data as $key => $value) {
$property = null === $inflector ? Inflector::camelize($key) : $inflector->camelize($key);
$this->$property = $value;
}
}
}
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| Package | Folder | 0755 |
|
|
| AbstractResult.php | File | 555 B | 0644 |
|
| Factory.php | File | 3.45 KB | 0644 |
|
| Package.php | File | 3.34 KB | 0644 |
|
| Result.php | File | 1.11 KB | 0644 |
|