1 | <?php |
||
49 | abstract class AbstractLogFactory implements FactoryInterface |
||
50 | { |
||
51 | /** |
||
52 | * Returns true if this factory can handle the requested path |
||
53 | * |
||
54 | * @param PathInformationInterface $path The path information |
||
55 | * @param string $mode The mode used to open the file |
||
56 | * @return boolean True if this factory can handle the path |
||
57 | */ |
||
58 | 50 | public function canHandle(PathInformationInterface $path, $mode) |
|
62 | |||
63 | /** |
||
64 | * Returns the file stream to handle the requested path |
||
65 | * |
||
66 | * @param PathInformationInterface $path The path information |
||
67 | * @param string $mode The mode used to open the path |
||
68 | * @return FileBufferInterface The file buffer to handle the path |
||
69 | */ |
||
70 | 2 | public function createFileBuffer(PathInformationInterface $path, $mode) |
|
71 | { |
||
72 | 2 | return new StringBuffer( |
|
73 | 2 | $this->createLogString( |
|
74 | 2 | $path->getRepository(), |
|
75 | 2 | $path->getArgument('limit'), |
|
76 | 2 | $path->getArgument('skip') |
|
77 | ), |
||
78 | 2 | array(), |
|
79 | 2 | 'r' |
|
80 | ); |
||
81 | } |
||
82 | |||
83 | /** |
||
84 | * Creates the log string to be fed into the string buffer |
||
85 | * |
||
86 | * @param RepositoryInterface $repository The repository |
||
87 | * @param integer|null $limit The maximum number of log entries returned |
||
88 | * @param integer|null $skip Number of log entries that are skipped from the beginning |
||
89 | * @return string |
||
90 | */ |
||
91 | abstract protected function createLogString(RepositoryInterface $repository, $limit, $skip); |
||
92 | } |
||
93 |