DBDiff\Params\ParamsFactory::get PHP Method

get() public static method

public static get ( )
    public static function get()
    {
        $params = new DefaultParams();
        $cli = new CLIGetter();
        $paramsCLI = $cli->getParams();
        if (!isset($paramsCLI->debug)) {
            error_reporting(E_ERROR);
        }
        $fs = new FSGetter($paramsCLI);
        $paramsFS = $fs->getParams();
        $params = self::merge($params, $paramsFS);
        $params = self::merge($params, $paramsCLI);
        if (empty($params->server1)) {
            throw new CLIException("A server is required");
        }
        return $params;
    }

Usage Example

Example #1
0
 public function tag($table)
 {
     foreach ($this->sourceBucket as &$entry1) {
         if (is_null($entry1)) {
             continue;
         }
         foreach ($this->targetBucket as &$entry2) {
             if (is_null($entry2)) {
                 continue;
             }
             if ($this->isKeyEqual($entry1, $entry2)) {
                 // unset the fields to ignore
                 $params = ParamsFactory::get();
                 if (isset($params->fieldsToIgnore[$table])) {
                     foreach ($params->fieldsToIgnore[$table] as $fieldToIgnore) {
                         unset($entry1[$fieldToIgnore]);
                         unset($entry2[$fieldToIgnore]);
                     }
                 }
                 $differ = new MapDiffer();
                 $diff = $differ->doDiff($entry2, $entry1);
                 if (!empty($diff)) {
                     $this->diffBucket[] = ['keys' => array_only($entry1, $this->key), 'diff' => $diff];
                 }
                 $entry1 = null;
                 $entry2 = null;
             }
         }
     }
 }
All Usage Examples Of DBDiff\Params\ParamsFactory::get
ParamsFactory