# bit-form/2.0/includes/Core/Fallback/FallBack.php

Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator &amp; Custom Form Builder, version 2.0. 44 lines.

- Page: https://pluginprobe.com/plugins/bit-form/2.0/code/includes/Core/Fallback/FallBack.php
- Raw: https://pluginprobe.com/plugins/bit-form/2.0/raw/includes/Core/Fallback/FallBack.php
- Modified: 2023-02-28T14:03:48+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/bit-form/2.0/code/includes/Core/Fallback/FallBack.php#L10-L20`.

```php
<?php

namespace BitCode\BitForm\Core\Fallback;

use ReflectionMethod;

final class FallBack {
  public static function getOlderVersion() {
    $installed = get_option('bitforms_installed');
    $oldversion = null;
    if ($installed) {
      $oldversion = get_option('bitforms_version');
    }
    return $oldversion;
  }

  public static function add($version, $invokeable, $check = '>=') {
    $oldversion = self::getOlderVersion();
    if ($oldversion && version_compare($oldversion, BITFORMS_VERSION, '!=')) {
      return static::action($version, $invokeable, $oldversion, $check);
    }
  }

  public static function action($version, $invokeable, $oldversion, $check) {
    $namespace = 'BitCode\BitForm\Core\Fallback';
    $invoke = explode('@', $invokeable);
    if (is_array($invoke) && 2 === count($invoke)) {
      $fileName = $invoke[0];
      $method = $invoke[1];
      $class = $namespace . '\\' . $fileName;
      if (class_exists($class) && method_exists($class, $method)) {
        $invokeMethod = new ReflectionMethod($class, $method);
        if (version_compare($version, $oldversion, $check)) {
          $invokeMethod->invoke($invokeMethod->isStatic() ? null : new $class());
        }
      } else {
        return 'Method or class not exist';
      }
    } else {
      return 'Invalid invokeable';
    }
  }
}

```
