3
clone
에 연쇄를 사용하여 메서드를 호출하는 인스턴스가 가능합니까?인스턴스 복제 및 메서드 호출 연결 가능?
/**
* Parse an object containing (eventually) "duration" property or "year" (and
* eventually) "month" properties.
*
* @return array Array containing start date and end date DateTime objects.
*/
public function parseTimeArgs($args)
{
$now = new DateTime();
if(isset($args->duration) && $duration = new DateInterval($args->duration))
return array((clone $now)->sub($duration), $now);
}
네, 그게 옳은 방법이라는 것을 이해하는 것은 어렵지 않지만 체인 연결에 대해서 말하고 있습니다 :'(clone $ now) -> method()'. – Polmonino