modifs.mineures sans commentaires
This commit is contained in:
		
							parent
							
								
									dca04418b7
								
							
						
					
					
						commit
						64e343dd38
					
				@ -15,6 +15,7 @@ class Bs3IconManager implements IIconManager {
 | 
				
			|||||||
    "config" => "cog",
 | 
					    "config" => "cog",
 | 
				
			||||||
    "save" => "floppy-disk",
 | 
					    "save" => "floppy-disk",
 | 
				
			||||||
    "download" => "download-alt",
 | 
					    "download" => "download-alt",
 | 
				
			||||||
 | 
					    "upload" => "cloud-upload",
 | 
				
			||||||
    "new_window",
 | 
					    "new_window",
 | 
				
			||||||
    "mail" => "enveloppe",
 | 
					    "mail" => "enveloppe",
 | 
				
			||||||
    "search",
 | 
					    "search",
 | 
				
			||||||
@ -84,6 +85,7 @@ EOT;
 | 
				
			|||||||
    'config' => 'cog',
 | 
					    'config' => 'cog',
 | 
				
			||||||
    'save' => 'floppy-disk',
 | 
					    'save' => 'floppy-disk',
 | 
				
			||||||
    'download' => 'download-alt',
 | 
					    'download' => 'download-alt',
 | 
				
			||||||
 | 
					    'upload' => 'cloud-upload',
 | 
				
			||||||
    'new_window' => 'new-window',
 | 
					    'new_window' => 'new-window',
 | 
				
			||||||
    'mail' => 'enveloppe',
 | 
					    'mail' => 'enveloppe',
 | 
				
			||||||
    'search' => 'search',
 | 
					    'search' => 'search',
 | 
				
			||||||
@ -138,6 +140,7 @@ EOT;
 | 
				
			|||||||
  const CONFIG = /*autogen*/['<span class="glyphicon glyphicon-cog" aria-hidden="true"></span>'];
 | 
					  const CONFIG = /*autogen*/['<span class="glyphicon glyphicon-cog" aria-hidden="true"></span>'];
 | 
				
			||||||
  const SAVE = /*autogen*/['<span class="glyphicon glyphicon-floppy-disk" aria-hidden="true"></span>'];
 | 
					  const SAVE = /*autogen*/['<span class="glyphicon glyphicon-floppy-disk" aria-hidden="true"></span>'];
 | 
				
			||||||
  const DOWNLOAD = /*autogen*/['<span class="glyphicon glyphicon-download-alt" aria-hidden="true"></span>'];
 | 
					  const DOWNLOAD = /*autogen*/['<span class="glyphicon glyphicon-download-alt" aria-hidden="true"></span>'];
 | 
				
			||||||
 | 
					  const UPLOAD = /*autogen*/['<span class="glyphicon glyphicon-cloud-upload" aria-hidden="true"></span>'];
 | 
				
			||||||
  const NEW_WINDOW = /*autogen*/['<span class="glyphicon glyphicon-new-window" aria-hidden="true"></span>'];
 | 
					  const NEW_WINDOW = /*autogen*/['<span class="glyphicon glyphicon-new-window" aria-hidden="true"></span>'];
 | 
				
			||||||
  const MAIL = /*autogen*/['<span class="glyphicon glyphicon-enveloppe" aria-hidden="true"></span>'];
 | 
					  const MAIL = /*autogen*/['<span class="glyphicon glyphicon-enveloppe" aria-hidden="true"></span>'];
 | 
				
			||||||
  const SEARCH = /*autogen*/['<span class="glyphicon glyphicon-search" aria-hidden="true"></span>'];
 | 
					  const SEARCH = /*autogen*/['<span class="glyphicon glyphicon-search" aria-hidden="true"></span>'];
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										51
									
								
								src/A.php
									
									
									
									
									
								
							
							
						
						
									
										51
									
								
								src/A.php
									
									
									
									
									
								
							@ -64,7 +64,7 @@ class A {
 | 
				
			|||||||
    $dest = cl::mpselect($dest, $merge, $pkeys);
 | 
					    $dest = cl::mpselect($dest, $merge, $pkeys);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  static final function append_nn(?array &$dest, $value, $key=null) {
 | 
					  static final function set_nn(?array &$dest, $key, $value) {
 | 
				
			||||||
    if ($value !== null) {
 | 
					    if ($value !== null) {
 | 
				
			||||||
      if ($key === null) $dest[] = $value;
 | 
					      if ($key === null) $dest[] = $value;
 | 
				
			||||||
      else $dest[$key] = $value;
 | 
					      else $dest[$key] = $value;
 | 
				
			||||||
@ -72,7 +72,11 @@ class A {
 | 
				
			|||||||
    return $value;
 | 
					    return $value;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  static final function append_nz(?array &$dest, $value, $key=null) {
 | 
					  static final function append_nn(?array &$dest, $value, $key=null) {
 | 
				
			||||||
 | 
					    return self::set_nn($dest, $key, $value);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  static final function set_nz(?array &$dest, $key, $value) {
 | 
				
			||||||
    if ($value !== null && $value !== false) {
 | 
					    if ($value !== null && $value !== false) {
 | 
				
			||||||
      if ($key === null) $dest[] = $value;
 | 
					      if ($key === null) $dest[] = $value;
 | 
				
			||||||
      else $dest[$key] = $value;
 | 
					      else $dest[$key] = $value;
 | 
				
			||||||
@ -80,6 +84,10 @@ class A {
 | 
				
			|||||||
    return $value;
 | 
					    return $value;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  static final function append_nz(?array &$dest, $value, $key=null) {
 | 
				
			||||||
 | 
					    return self::set_nz($dest, $key, $value);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  static final function prepend_nn(?array &$dest, $value) {
 | 
					  static final function prepend_nn(?array &$dest, $value) {
 | 
				
			||||||
    if ($value !== null) {
 | 
					    if ($value !== null) {
 | 
				
			||||||
      if ($dest === null) $dest = [];
 | 
					      if ($dest === null) $dest = [];
 | 
				
			||||||
@ -95,4 +103,43 @@ class A {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
    return $value;
 | 
					    return $value;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  static final function replace_nx(?array &$dest, $key, $value) {
 | 
				
			||||||
 | 
					    if ($dest !== null && !array_key_exists($key, $dest)) {
 | 
				
			||||||
 | 
					      return $dest[$key] = $value;
 | 
				
			||||||
 | 
					    } else {
 | 
				
			||||||
 | 
					      return $dest[$key] ?? null;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  static final function replace_n(?array &$dest, $key, $value) {
 | 
				
			||||||
 | 
					    $pvalue = $dest[$key] ?? null;
 | 
				
			||||||
 | 
					    if ($pvalue === null) $dest[$key] = $value;
 | 
				
			||||||
 | 
					    return $pvalue;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  static final function replace_z(?array &$dest, $key, $value) {
 | 
				
			||||||
 | 
					    $pvalue = $dest[$key] ?? null;
 | 
				
			||||||
 | 
					    if ($pvalue === null || $pvalue === false) $dest[$key] = $value;
 | 
				
			||||||
 | 
					    return $pvalue;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  static final function pop(?array $dest, $key, $default=null) {
 | 
				
			||||||
 | 
					    if ($dest === null) return $default;
 | 
				
			||||||
 | 
					    if ($key === null) return array_pop($dest);
 | 
				
			||||||
 | 
					    $value = $dest[$key] ?? $default;
 | 
				
			||||||
 | 
					    unset($dest[$key]);
 | 
				
			||||||
 | 
					    return $value;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  static final function popx(?array $dest, ?array $keys): array {
 | 
				
			||||||
 | 
					    $values = [];
 | 
				
			||||||
 | 
					    if ($dest === null) return $values;
 | 
				
			||||||
 | 
					    if ($keys === null) return $values;
 | 
				
			||||||
 | 
					    foreach ($keys as $key) {
 | 
				
			||||||
 | 
					      $values[$key] = self::pop($dest, $key);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    return $values;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -18,6 +18,7 @@ abstract class AbstractReader  implements IReader {
 | 
				
			|||||||
    $this->schema = $params["schema"] ?? static::SCHEMA;
 | 
					    $this->schema = $params["schema"] ?? static::SCHEMA;
 | 
				
			||||||
    $this->headers = $params["headers"] ?? static::HEADERS;
 | 
					    $this->headers = $params["headers"] ?? static::HEADERS;
 | 
				
			||||||
    $this->input = $params["input"] ?? static::INPUT;
 | 
					    $this->input = $params["input"] ?? static::INPUT;
 | 
				
			||||||
 | 
					    $this->parseEmptyAsNull = boolval($params["empty_as_null"] ?? true);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  protected ?array $schema;
 | 
					  protected ?array $schema;
 | 
				
			||||||
@ -26,6 +27,8 @@ abstract class AbstractReader  implements IReader {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  protected $input;
 | 
					  protected $input;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  protected bool $parseEmptyAsNull;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  protected int $isrc = 0, $idest = 0;
 | 
					  protected int $isrc = 0, $idest = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  protected function cook(array &$row): bool {
 | 
					  protected function cook(array &$row): bool {
 | 
				
			||||||
@ -45,10 +48,14 @@ abstract class AbstractReader  implements IReader {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  protected function verifixCol(&$col): void {
 | 
					  protected function verifixCol(&$col): void {
 | 
				
			||||||
    # conversion Date et DateTime
 | 
					    if ($col === "" && $this->parseEmptyAsNull) {
 | 
				
			||||||
    if (DateTime::isa_datetime($col, true)) {
 | 
					      # valeur vide --> null
 | 
				
			||||||
 | 
					      $col = null;
 | 
				
			||||||
 | 
					    } elseif (DateTime::isa_datetime($col, true)) {
 | 
				
			||||||
 | 
					      # datetime
 | 
				
			||||||
      $col = new DateTime($col);
 | 
					      $col = new DateTime($col);
 | 
				
			||||||
    } elseif (DateTime::isa_date($col, true)) {
 | 
					    } elseif (DateTime::isa_date($col, true)) {
 | 
				
			||||||
 | 
					      # date
 | 
				
			||||||
      $col = new Date($col);
 | 
					      $col = new Date($col);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user