version management

    0

    1

    JVIT PHP

    The class help manage version in your system

    Shortcut: version

    
    /**
    * Version information class.
    *
    */
    final class Version
    {
      /** 
      * your version
      * @var string
      */
      const VERSION = '1.11.1';
    
      const MAJOR_VERSION = 1;
    
      public function isStableVersion($version)
      {
        return (bool) preg_match('/^(\d+)\.(\d+)\.(\d+)$/', $version);
      }
    
      public function isVersionNumber($version)
      {
        return $this->isStableVersion($version) || $this->isNonStableVersion($version);
      }
    
      private function isNonStableVersion($version)
      {
        return (bool) preg_match('/^(\d+)\.(\d+)\.(\d+)-.{1,4}(\d+)$/', $version);
      }
    }
    
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.