<?php
 namespace App\GenDocument\Vars; class PivotBuilderValues { static public function fromPivot($pivot, $idPivot, $documentType=null) { $class = '\App\GenDocument\Vars\Values_'.ucfirst($pivot); $obj = $class::getInstance($idPivot); if ($documentType) { $obj->setDocumentType($documentType); } return $obj; } } 