Skip to content

Commit 2a42da5

Browse files
Add toArray methods
1 parent 9d461ba commit 2a42da5

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed

src/Config/Routes/RouteAction.php

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,4 +319,41 @@ public function parseFromArray(array $data)
319319
$this->setTraverseMounts($data['traverse_mounts']);
320320
}
321321
}
322+
323+
/**
324+
* @return bool
325+
*/
326+
public function isFollowSymlinks(): bool
327+
{
328+
return $this->_follow_symlinks;
329+
}
330+
331+
/**
332+
* @return bool
333+
*/
334+
public function isTraverseMounts(): bool
335+
{
336+
return $this->_traverse_mounts;
337+
}
338+
339+
/**
340+
* @return array
341+
*/
342+
public function toArray(): array
343+
{
344+
return [
345+
'pass' => $this->getPass(),
346+
'proxy' => $this->getProxy(),
347+
'return' => $this->getReturn(),
348+
'location' => $this->getLocation(),
349+
'rewrite' => $this->getRewrite(),
350+
'share' => $this->getShare(),
351+
'index' => $this->getIndex(),
352+
'chroot' => $this->getChroot(),
353+
'types' => $this->getTypes(),
354+
'fallback' => $this->getFallback(),
355+
'follow_symlinks' => $this->isFollowSymlinks(),
356+
'traverse_mounts' => $this->isTraverseMounts()
357+
];
358+
}
322359
}

src/Config/Routes/RouteMatch.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,4 +298,23 @@ public function parseFromArray(array $data): void
298298
$this->setUri($data['uri']);
299299
}
300300
}
301+
302+
/**
303+
* @return array
304+
*/
305+
public function toArray(): array
306+
{
307+
return [
308+
'arguments' => $this->getArguments(),
309+
'cookies' => $this->getCookies(),
310+
'destination' => $this->getDestination(),
311+
'headers' => $this->getHeaders(),
312+
'host' => $this->getHost(),
313+
'method' => $this->getMethod(),
314+
'query' => $this->getQuery(),
315+
'scheme' => $this->getScheme(),
316+
'source' => $this->getSource(),
317+
'uri' => $this->getUri()
318+
];
319+
}
301320
}

0 commit comments

Comments
 (0)