Skip to content

Commit

Permalink
1.34
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgecc-business-account committed Dec 31, 2024
1 parent 0f98b6b commit d769990
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 36 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ It reads the URL route and parses the values of path, so it could be interpreted

[![Packagist](https://img.shields.io/packagist/v/eftec/routeone.svg)](https://packagist.org/packages/eftec/routeone)
[![Total Downloads](https://poser.pugx.org/eftec/routeone/downloads)](https://packagist.org/packages/eftec/routeone)
[![Maintenance](https://img.shields.io/maintenance/yes/2023.svg)]()
[![Maintenance](https://img.shields.io/maintenance/yes/2025.svg)]()
[![composer](https://img.shields.io/badge/composer-%3E1.6-blue.svg)]()
[![php](https://img.shields.io/badge/php-%3E7.1-green.svg)]()
[![php](https://img.shields.io/badge/php-%3E8.0-green.svg)]()
[![php](https://img.shields.io/badge/php-%3E7.4-green.svg)]()
[![php](https://img.shields.io/badge/php-%3E8.4-green.svg)]()
[![coverage](https://img.shields.io/badge/coverage-80%25-green)]()
[![compatible](https://img.shields.io/badge/compatible-linux%7Cwindows%7Cmacos-green)]()

Expand Down Expand Up @@ -859,6 +859,8 @@ Now, lets configure the paths


## Changelog
* 2024-12-31 1.34
* updated to PHP 8.4
* 2024-03-02 1.33
* Updating dependency to PHP 7.4. The extended support of PHP 7.2 ended 3 years ago.
* Added more type hinting in the code.
Expand Down
6 changes: 3 additions & 3 deletions lib/RouteOne.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
* @package RouteOne
* @copyright 2019-2024 Jorge Castro Castillo
* @license (dual licence lgpl v3 and commercial)
* @version 1.33 2024-03-02
* @version 1.34 2024-12-31
* @link https://github.com/EFTEC/RouteOne
*/
class RouteOne
{
public const VERSION = '1.33';
public const VERSION = '1.34';
/** @var RouteOne|null */
public static ?RouteOne $instance = null;
/** @var string The name of the argument used by apache and nginx (by default it is req) */
Expand Down Expand Up @@ -101,7 +101,7 @@ class RouteOne
/**
* @var string|null=['api','ws','controller','front'][$i]
*/
private ?string $forceType;
private ?string $forceType = '';
private string $defController = '';
private string $defAction = '';
private string $defCategory = '';
Expand Down
59 changes: 29 additions & 30 deletions lib/RouteOneCli.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class RouteOneCli
public CliOne $cli;
public const VERSION = "1.1";
/** @var RouteOne|null */
public ?RouteOne $route= null;
public ?RouteOne $route = null;
public array $paths = [];

/**
Expand All @@ -24,7 +24,7 @@ public function __construct(bool $run = true)
{
$this->route = new RouteOne();
$this->cli = CliOne::instance();
$this->cli->debug=true;
$this->cli->debug = true;
if (!CliOne::hasMenu()) {
$this->cli->setErrorType();
$this->cli->addMenu('mainmenu',
Expand Down Expand Up @@ -104,7 +104,6 @@ function($cli) {
}
$this->cli->evalMenu('mainmenu', $this);
}

}

public function showLogo(): void
Expand Down Expand Up @@ -146,7 +145,7 @@ public function menuRouterOnePaths(): void
//->setAllowEmpty()
->setInput()
->setDescription('', 'Select the name of the path',
['select an unique name for this path','example:web'])
['select an unique name for this path', 'example:web'])
->evalParam(true);
$tmp2 = $this->cli->createOrReplaceParam('extracolumn_sql')
//->setAllowEmpty()
Expand All @@ -155,13 +154,13 @@ public function menuRouterOnePaths(): void
['select the path to be used using the syntax:',
'fixedpath/{requiredvalue}/{optionalvalue:defaultvalue}',
'Example:{controller:Home}/{id}/{idparent} '
,'{controller}: the controller'
,'{action}: the action'
,'{id}: the identifier'
,'{idparent}: the parent object'
,'{category}: the category'
,'{subcategory}: the subcategory'
,'{subsubcategory}: the subsubcategory'])
, '{controller}: the controller'
, '{action}: the action'
, '{id}: the identifier'
, '{idparent}: the parent object'
, '{category}: the category'
, '{subcategory}: the subcategory'
, '{subsubcategory}: the subsubcategory'])
->setDefault('{controller:Home}/{action:list}/{id}/{idparent}')
->evalParam(true);
$tmp3 = $this->cli->createOrReplaceParam('extracolumn_namespace')
Expand Down Expand Up @@ -197,15 +196,15 @@ public function menuRouterOnePaths(): void
->setDescription('', 'Select the path',
['select the path to be used using the syntax {id:defaultvalue}',
'example:{controller:Home}/{id}/{idparent} '
,'{controller}: the controller'
,'{action}: the action'
,'{event}: the event'
,'{verb}: the verb (GET/POST/etc.)'
,'{id}: the identifier'
,'{idparent}: the parent object'
,'{category}: the category'
,'{subcategory}: the subcategory'
,'{subsubcategory}: the subsubcategory'])
, '{controller}: the controller'
, '{action}: the action'
, '{event}: the event'
, '{verb}: the verb (GET/POST/etc.)'
, '{id}: the identifier'
, '{idparent}: the parent object'
, '{category}: the category'
, '{subcategory}: the subcategory'
, '{subsubcategory}: the subsubcategory'])
->setDefault($v[0])
->evalParam(true);
$tmp3 = $this->cli->createOrReplaceParam('extracolumn_sql2')
Expand Down Expand Up @@ -349,12 +348,12 @@ public function menuRouterOneConfigure(): void
{
$this->cli->upLevel('configure');
$this->cli->setColor(['byellow'])->showBread();
/* $this->cli->createOrReplaceParam('routerfilename', [], 'onlyinput')
->setDescription('The router filename', 'Select the router filename', [
'example: index.php'])
->setInput(true, 'string', 'index.php')
->setCurrentAsDefault()
->evalParam(true);*/
/* $this->cli->createOrReplaceParam('routerfilename', [], 'onlyinput')
->setDescription('The router filename', 'Select the router filename', [
'example: index.php'])
->setInput(true, 'string', 'index.php')
->setCurrentAsDefault()
->evalParam(true);*/
$this->cli->createOrReplaceParam('dev', [], 'none')
->setDefault(gethostname())
->setCurrentAsDefault()
Expand Down Expand Up @@ -385,17 +384,17 @@ public function menuRouterOneConfigure(): void

public function getConfig(): array
{
$r= $this->cli->getValueAsArray([ 'baseurldev', 'baseurlprod', 'dev']);
$r['dev']= $r['dev']==='yes'?gethostname():'';
$r['paths']=$this->paths;
$r = $this->cli->getValueAsArray(['baseurldev', 'baseurlprod', 'dev']);
$r['dev'] = $r['dev'] === 'yes' ? gethostname() : '';
$r['paths'] = $this->paths;
return $r;
}

public function setConfig(array $array): void
{
$this->paths = $array['paths'];
unset($array['paths']);
$this->cli->setParamUsingArray($array, [ 'baseurldev', 'baseurlprod', 'dev']);
$this->cli->setParamUsingArray($array, ['baseurldev', 'baseurlprod', 'dev']);
$this->cli->callVariablesCallBack();
}

Expand Down

0 comments on commit d769990

Please sign in to comment.