public function doFullBootBuildIfNecessary(AviatorApp $app)
    {
        // check if the watcher is running
        $beaconUpdatedAt = $this->getChangedAt(Aviator::getInstallDir() . '/tmp/watch_beacon');

        if ($beaconUpdatedAt > LocalDate::now()->modifyBySeconds(3)->getTimestamp()) {
            echo DebugErrorHandler::watcherBeaconInFuture();
            die();
        }

        if (PHP_SAPI !== 'cli' && $beaconUpdatedAt < LocalDate::now()->modifyBySeconds(-3)->getTimestamp()) {
            echo DebugErrorHandler::watcherNotRunning();
            exit(-1);
        }

        // when the container does not exist we need a build
        $needsBuild = ! class_exists($app->getContainerFqcn());

        // when the container is older then the last file update we need a build as well
        if (! $needsBuild) {
            $reflect       = new \ReflectionClass($app->getContainerFqcn());
            $containerFile = $reflect->getFileName();

            clearstatcache(true, $containerFile);

            $fileUpdatedAt = $this->getChangedAt(Aviator::getInstallDir() . '/tmp/file_update_found');

            // is the container outdated ?
            $needsBuild = filemtime($containerFile) < $fileUpdatedAt;
        }

        // so do we need a build now ?
        if ($needsBuild) {
            $this->doFullBootBuild($app);
        }
    }
public function doFullBootBuildIfNecessary(AviatorApp $app)
    {
        // check if the watcher is running
        $beaconUpdatedAt = $this->getChangedAt(Aviator::getInstallDir() . '/tmp/watch_beacon');

        if ($beaconUpdatedAt > LocalDate::now()->modifyBySeconds(3)->getTimestamp()) {
            echo DebugErrorHandler::watcherBeaconInFuture();
            die();
        }

        if (PHP_SAPI !== 'cli' && $beaconUpdatedAt < LocalDate::now()->modifyBySeconds(-3)->getTimestamp()) {
            echo DebugErrorHandler::watcherNotRunning();
            exit(-1);
        }

        // when the container does not exist we need a build
        $needsBuild = ! class_exists($app->getContainerFqcn());

        // when the container is older then the last file update we need a build as well
        if (! $needsBuild) {
            $reflect       = new \ReflectionClass($app->getContainerFqcn());
            $containerFile = $reflect->getFileName();

            clearstatcache(true, $containerFile);

            $fileUpdatedAt = $this->getChangedAt(Aviator::getInstallDir() . '/tmp/file_update_found');

            // is the container outdated ?
            $needsBuild = filemtime($containerFile) < $fileUpdatedAt;
        }

        // so do we need a build now ?
        if ($needsBuild) {
            $this->doFullBootBuild($app);
        }
    }
public function doFullBootBuildIfNecessary ( AviatorApp $ app ) { // check if the watcher is running $ beaconUpdatedAt = $ this -> getChangedAt ( Aviator :: getInstallDir ( ) . '/tmp/watch_beacon' ) ; if ( $ beaconUpdatedAt > LocalDate :: now ( ) -> modifyBySeconds ( 3 ) -> getTimestamp ( ) ) { echo DebugErrorHandler :: watcherBeaconInFuture ( ) ; die ( ) ; } if ( PHP_SAPI !== 'cli' && $ beaconUpdatedAt < LocalDate :: now ( ) -> modifyBySeconds ( - 3 ) -> getTimestamp ( ) ) { echo DebugErrorHandler :: watcherNotRunning ( ) ; exit ( - 1 ) ; } // when the container does not exist we need a build $ needsBuild = ! class_exists ( $ app -> getContainerFqcn ( ) ) ; // when the container is older then the last file update we need a build as well if ( ! $ needsBuild ) { $ reflect = new \ ReflectionClass ( $ app -> getContainerFqcn ( ) ) ; $ containerFile = $ reflect -> getFileName ( ) ; clearstatcache ( true , $ containerFile ) ; $ fileUpdatedAt = $ this -> getChangedAt ( Aviator :: getInstallDir ( ) . '/tmp/file_update_found' ) ; // is the container outdated ? $ needsBuild = filemtime ( $ containerFile ) < $ fileUpdatedAt ; } // so do we need a build now ? if ( $ needsBuild ) { $ this -> doFullBootBuild ( $ app ) ; } }
Do a full build in dev mode if it is necessary

@param AviatorApp $app
Do a full build in dev mode if it is necessary