Skip to content

Commit 62c2ac4

Browse files
committed
Merge branch 'release/0.6.47'
2 parents d86e91c + 968185e commit 62c2ac4

File tree

5 files changed

+22
-74
lines changed

5 files changed

+22
-74
lines changed

.version.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
"strategy": "semver",
33
"major": 0,
44
"minor": 6,
5-
"patch": 46,
5+
"patch": 47,
66
"build": 0
77
}

readme.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -239,11 +239,10 @@ cache:
239239
storage: file
240240
path: cache/views
241241
ttl: 3600 # Default TTL in seconds
242-
views:
243-
html: true # Enable HTML view caching
244-
markdown: true # Enable Markdown view caching
245-
json: false # Disable JSON response caching
246-
xml: false # Disable XML response caching
242+
html: true # Enable HTML view caching
243+
markdown: true # Enable Markdown view caching
244+
json: false # Disable JSON response caching
245+
xml: false # Disable XML response caching
247246
# Garbage collection settings (optional)
248247
gc_probability: 0.01 # 1% chance to run GC on cache write
249248
gc_divisor: 100 # Fine-tune probability calculation

src/Mvc/Cli/Commands/Routes/ListCommand.php

Lines changed: 14 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -246,57 +246,27 @@ private function filterRoutes( array $routes ): array
246246
private function outputTable( array $routes ): void
247247
{
248248
$this->output->title( 'MVC Routes' );
249-
$this->output->write( str_repeat( '=', 80 ) );
250249

251-
// Calculate column widths
252-
$maxPattern = 20;
253-
$maxController = 20;
254-
$maxAction = 15;
250+
// Prepare table headers
251+
$headers = ['Pattern', 'Method', 'Controller', 'Action', 'Parameters'];
255252

253+
// Prepare table rows
254+
$rows = [];
256255
foreach( $routes as $route )
257256
{
258-
$maxPattern = max( $maxPattern, strlen( $route['pattern'] ) );
259-
$maxController = max( $maxController, strlen( $route['controller'] ) );
260-
$maxAction = max( $maxAction, strlen( $route['action'] ) );
261-
}
262-
263-
// Limit widths
264-
$maxPattern = min( $maxPattern, 40 );
265-
$maxController = min( $maxController, 30 );
266-
$maxAction = min( $maxAction, 20 );
267-
268-
// Output header
269-
$header = sprintf(
270-
"%-{$maxPattern}s | %-6s | %-{$maxController}s | %-{$maxAction}s | %s",
271-
'Pattern',
272-
'Method',
273-
'Controller',
274-
'Action',
275-
'Parameters'
276-
);
277-
278-
$this->output->info( $header );
279-
$this->output->write( str_repeat( '-', strlen( $header ) + 10 ) );
280-
281-
// Output routes
282-
foreach( $routes as $route )
283-
{
284-
$pattern = $this->truncate( $route['pattern'], $maxPattern );
285-
$controller = $this->truncate( $route['controller'], $maxController );
286-
$action = $this->truncate( $route['action'], $maxAction );
287-
$parameters = empty( $route['parameters'] ) ? '-' : implode( ', ', $route['parameters'] );
288-
289-
$this->output->write( sprintf(
290-
"%-{$maxPattern}s | %-6s | %-{$maxController}s | %-{$maxAction}s | %s",
291-
$pattern,
257+
$rows[] = [
258+
$route['pattern'],
292259
$route['method'],
293-
$controller,
294-
$action,
295-
$parameters
296-
));
260+
$route['controller'],
261+
$route['action'],
262+
empty( $route['parameters'] ) ? '-' : implode( ', ', $route['parameters'] )
263+
];
297264
}
298265

299-
$this->output->write( '' );
266+
// Display the table using Output's table method
267+
$this->output->table( $headers, $rows );
268+
269+
$this->output->newLine();
300270
$this->output->info( 'Total routes: ' . count( $routes ) );
301271

302272
// Show method distribution
@@ -320,23 +290,6 @@ private function outputJson( array $routes ): void
320290
$this->output->write( json_encode( $routes, JSON_PRETTY_PRINT ) );
321291
}
322292

323-
/**
324-
* Truncate string to maximum length
325-
*
326-
* @param string $str
327-
* @param int $maxLength
328-
* @return string
329-
*/
330-
private function truncate( string $str, int $maxLength ): string
331-
{
332-
if( strlen( $str ) <= $maxLength )
333-
{
334-
return $str;
335-
}
336-
337-
return substr( $str, 0, $maxLength - 3 ) . '...';
338-
}
339-
340293
/**
341294
* Try to find the configuration directory
342295
*

src/Mvc/Cli/Provider.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,5 @@ public static function register( Registry $registry ): void
3434
'mvc:routes:list',
3535
'Neuron\\Mvc\\Cli\\Commands\\Routes\\ListCommand'
3636
);
37-
38-
// Future commands can be added here:
39-
// $registry->register( 'mvc:routes:test', 'Neuron\\Mvc\\Cli\\Commands\\Routes\\TestCommand' );
40-
// $registry->register( 'mvc:controller:create', 'Neuron\\Mvc\\Cli\\Commands\\Controller\\CreateCommand' );
41-
// $registry->register( 'mvc:view:create', 'Neuron\\Mvc\\Cli\\Commands\\View\\CreateCommand' );
42-
// $registry->register( 'mvc:serve', 'Neuron\\Mvc\\Cli\\Commands\\ServeCommand' );
4337
}
44-
}
38+
}

versionlog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
## 0.6.47 2025-08-13
2+
13
## 0.6.46 2025-08-13
24
* Added CLI commands.
35

0 commit comments

Comments
 (0)