private function prependOrderEntry($path, $prependedPath) { $lastEntry = reset($this->json['_order'][$path]); if ($prependedPath === $lastEntry['path']) { // If the first entry matches the new one, add the reference // of the current resource to the limit ++$lastEntry['references']; } else { array_unshift($this->json['_order'][$path], array('path' => $prependedPath, 'references' => 1)); } }