Validates that the container's application and temporary directory is available.

@return void
335894
protected function validateDirectories()
    {

        // query whether the container's application directory is available and readable
        $appBase = $this->getAppBase();
        if (!is_dir($appBase) || !is_readable($appBase)) {
            $this->getInitialContext()->getSystemLogger()->critical(
                sprintf(
                    'Base directory (appBase) %s of container %s is no directory or not readable, can\'t deploy applications',
                    $appBase,
                    $this->getName()
                )
            );
        }

        // query whether the container's temporary directory is available and readable
        $tmpDir = $this->getTmpDir();
        if (!is_dir($tmpDir) || !is_readable($tmpDir)) {
            $this->getInitialContext()->getSystemLogger()->critical(
                sprintf(
                    'Temporary directory (tmpDir) %s of container %s is no directory or not readable!',
                    $tmpDir,
                    $this->getName()
                )
            );
        }
    }
1211267
public function validateCurrentInstall() {
		if (!file_exists($this->installStatusFile)) {
			throw new MoufException("No install status file found. I don't know what install task should be run.");
		}
		
		$statusArray = json_decode(file_get_contents($this->installStatusFile), true);
		if ($statusArray['type'] == 'one') {
			$taskArray = $statusArray['task'];
			// Now, let's find the matching task and mark it "done".
			$installTask = $this->findInstallTaskFromArray($taskArray);
			$installTask->setStatus(AbstractInstallTask::STATUS_DONE);
			$this->save();
			
			// Finally, let's delete the install status file.
			unlink($this->installStatusFile);
		} else {
			$installTasks = $this->getInstallTasks();
			foreach ($installTasks as $installTask) {
				if ($installTask->getStatus() == AbstractInstallTask::STATUS_TODO) {
					$installTask->setStatus(AbstractInstallTask::STATUS_DONE);
					$this->save();
					break;
				}
			}
			$todoRemaining = false;
			foreach ($installTasks as $installTask) {
				if ($installTask->getStatus() == AbstractInstallTask::STATUS_TODO) {
					$todoRemaining = true;
					break;
				}
			}
			if (!$todoRemaining) {
				// Finally, let's delete the install status file if there are no actions in "todo" state
				unlink($this->installStatusFile);
			}
		}
		
	}
154953
public function valid()
    {
        if ($this->_resource === null && $this->_filename) {
            $this->_resource = fopen($this->_filename, $this->_mode);
        }
        return !!$this->_resource && is_resource($this->_resource);
    }
454970
public function valid()
    {
        if ($this->container['shoutcastDestination'] === null) {
            return false;
        }
        if ($this->container['icecast2Public'] === null) {
            return false;
        }
        if ($this->container['akamaiDestinationServer'] === null) {
            return false;
        }
        if ($this->container['shoutcastIcq'] === null) {
            return false;
        }
        if ($this->container['facebookEventSourceName'] === null) {
            return false;
        }
        if ($this->container['timeToLive'] === null) {
            return false;
        }
        if ($this->container['password'] === null) {
            return false;
        }
        if ($this->container['facebookDestType'] === null) {
            return false;
        }
        if ($this->container['rtpWrap'] === null) {
            return false;
        }
        if ($this->container['icecast2Name'] === null) {
            return false;
        }
        if ($this->container['akamaiHostId'] === null) {
            return false;
        }
        if ($this->container['icecast2Icq'] === null) {
            return false;
        }
        if ($this->container['host'] === null) {
            return false;
        }
        if ($this->container['connectionFlashVersion'] === null) {
            return false;
        }
        if ($this->container['cupertinoRenditions'] === null) {
            return false;
        }
        if ($this->container['facebookTitle'] === null) {
            return false;
        }
        if ($this->container['debugPackets'] === null) {
            return false;
        }
        if ($this->container['shoutcastPublic'] === null) {
            return false;
        }
        if ($this->container['shoutcastAim'] === null) {
            return false;
        }
        if ($this->container['profile'] === null) {
            return false;
        }
        if ($this->container['icecast2Description'] === null) {
            return false;
        }
        if ($this->container['sessionStatus'] === null) {
            return false;
        }
        if ($this->container['shoutcastMetaname'] === null) {
            return false;
        }
        if ($this->container['icecast2Genre'] === null) {
            return false;
        }
        if ($this->container['facebookDestId'] === null) {
            return false;
        }
        if ($this->container['queryString'] === null) {
            return false;
        }
        if ($this->container['akamaiEventName'] === null) {
            return false;
        }
        if ($this->container['version'] === null) {
            return false;
        }
        if ($this->container['shoutcastName'] === null) {
            return false;
        }
        if ($this->container['sendStreamCloseCommands'] === null) {
            return false;
        }
        if ($this->container['port'] === null) {
            return false;
        }
        if ($this->container['sendFCPublish'] === null) {
            return false;
        }
        if ($this->container['icecast2Aim'] === null) {
            return false;
        }
        if ($this->container['httpPlaylistCount'] === null) {
            return false;
        }
        if ($this->container['httpPlaylistTimeout'] === null) {
            return false;
        }
        if ($this->container['facebookDestName'] === null) {
            return false;
        }
        if ($this->container['audioPort'] === null) {
            return false;
        }
        if ($this->container['icecast2Metaname'] === null) {
            return false;
        }
        if ($this->container['sourceStreamName'] === null) {
            return false;
        }
        if ($this->container['connectionCode'] === null) {
            return false;
        }
        if ($this->container['localBindAddress'] === null) {
            return false;
        }
        if ($this->container['shoutcastProtocol'] === null) {
            return false;
        }
        if ($this->container['debugLogChildren'] === null) {
            return false;
        }
        if ($this->container['serverName'] === null) {
            return false;
        }
        if ($this->container['adaptiveStreaming'] === null) {
            return false;
        }
        if ($this->container['facebookEventSourceType'] === null) {
            return false;
        }
        if ($this->container['enabled'] === null) {
            return false;
        }
        if ($this->container['shoutcastIrc'] === null) {
            return false;
        }
        if ($this->container['sendReleaseStream'] === null) {
            return false;
        }
        if ($this->container['shoutcastUrl'] === null) {
            return false;
        }
        if ($this->container['icecast2Irc'] === null) {
            return false;
        }
        if ($this->container['facebookDescription'] === null) {
            return false;
        }
        if ($this->container['debugLog'] === null) {
            return false;
        }
        if ($this->container['shoutcastGenre'] === null) {
            return false;
        }
        if ($this->container['akamaiStreamId'] === null) {
            return false;
        }
        if ($this->container['akamaiHdNetwork'] === null) {
            return false;
        }
        if ($this->container['adaptiveGroups'] === null) {
            return false;
        }
        if ($this->container['httpPlaylistAcrossSessions'] === null) {
            return false;
        }
        if ($this->container['secureTokenSharedSecret'] === null) {
            return false;
        }
        if ($this->container['httpFakePosts'] === null) {
            return false;
        }
        if ($this->container['sendSSL'] === null) {
            return false;
        }
        if ($this->container['sendOriginalTimecodes'] === null) {
            return false;
        }
        if ($this->container['icecast2Destination'] === null) {
            return false;
        }
        if ($this->container['facebookAccessToken'] === null) {
            return false;
        }
        if ($this->container['userName'] === null) {
            return false;
        }
        if ($this->container['facebookPrivacy'] === null) {
            return false;
        }
        if ($this->container['streamName'] === null) {
            return false;
        }
        if ($this->container['removeDefaultAppInstance'] === null) {
            return false;
        }
        if ($this->container['videoPort'] === null) {
            return false;
        }
        if ($this->container['httpWriterDebug'] === null) {
            return false;
        }
        if ($this->container['icecast2Url'] === null) {
            return false;
        }
        if ($this->container['akamaiSendToBackupServer'] === null) {
            return false;
        }
        if ($this->container['destinationServer'] === null) {
            return false;
        }
        if ($this->container['application'] === null) {
            return false;
        }
        if ($this->container['entryName'] === null) {
            return false;
        }
        if ($this->container['streamWaitTimeout'] === null) {
            return false;
        }
        if ($this->container['appInstance'] === null) {
            return false;
        }
        if ($this->container['originalTimecodeThreshold'] === null) {
            return false;
        }
        if ($this->container['autoStartTranscoder'] === null) {
            return false;
        }
        if ($this->container['sanjoseRepresentationId'] === null) {
            return false;
        }
        return true;
    }
650813
private void validateArguments() throws BuildException {
    Path tempDir = getTempDir();

    if (tempDir == null) {
      throw new BuildException("Temporary directory cannot be null.");
    }
    
    if (Files.exists(tempDir)) {
      if (!Files.isDirectory(tempDir)) {
        throw new BuildException("Temporary directory is not a folder: " + tempDir.toAbsolutePath());
      }
    } else {
      try {
        Files.createDirectories(tempDir);
      } catch (IOException e) {
        throw new BuildException("Failed to create temporary folder: " + tempDir, e);
      }
    }
  }
390470
public function validate()
    {
        // Delete the file when requested
        if (true === $this->enableReset && $this->getPost($this->strName.'_reset')) {
            if (null !== ($fileModel = FilesModel::findByPk($this->varValue))) {
                $file = new File($fileModel->path);
                $file->delete();
            }

            unset($_FILES[$this->strName]);

            return;
        }

        // Handle file upload
        parent::validate();

        // Set the image as varValue
        $file = $_SESSION['FILES'][$this->strName];
        if (true === $file['uploaded']) {
            $this->varValue = StringUtil::uuidToBin($file['uuid']);
        } else {
            $this->blnSubmitInput = false;
        }
    }
1311378
protected function validateFilePath()
    {
        if (file_exists($this->filePath)) {
            if (!is_writable($this->filePath)) {
                throw new RuntimeException(
                    "File '{$this->filePath}' exist but is not writable"
                );
            }
        } else {
            if (!is_writable(dirname($this->filePath))) {
                throw new RuntimeException(
                    "File '{$this->filePath}' is not writable"
                );
            }
        }
    }
319937
public function valid()
    {

        if ($this->container['typeId'] === null) {
            return false;
        }
        if ($this->container['quantity'] === null) {
            return false;
        }
        if ($this->container['locationId'] === null) {
            return false;
        }
        if ($this->container['locationType'] === null) {
            return false;
        }
        $allowedValues = $this->getLocationTypeAllowableValues();
        if (!in_array($this->container['locationType'], $allowedValues)) {
            return false;
        }
        if ($this->container['itemId'] === null) {
            return false;
        }
        if ($this->container['locationFlag'] === null) {
            return false;
        }
        $allowedValues = $this->getLocationFlagAllowableValues();
        if (!in_array($this->container['locationFlag'], $allowedValues)) {
            return false;
        }
        if ($this->container['isSingleton'] === null) {
            return false;
        }
        return true;
    }
959458
public function valid() {
    if (isset($this->resources[$this->position])) {
      return true;
    }
    $this->preloadPage();
    return isset($this->resources[$this->position]);
  }
834439
public function valid()
    {

        if ($this->container['loggedAt'] === null) {
            return false;
        }
        if ($this->container['containerId'] === null) {
            return false;
        }
        if ($this->container['containerTypeId'] === null) {
            return false;
        }
        if ($this->container['characterId'] === null) {
            return false;
        }
        if ($this->container['locationId'] === null) {
            return false;
        }
        if ($this->container['locationFlag'] === null) {
            return false;
        }
        $allowedValues = $this->getLocationFlagAllowableValues();
        if (!in_array($this->container['locationFlag'], $allowedValues)) {
            return false;
        }
        if ($this->container['action'] === null) {
            return false;
        }
        $allowedValues = $this->getActionAllowableValues();
        if (!in_array($this->container['action'], $allowedValues)) {
            return false;
        }
        $allowedValues = $this->getPasswordTypeAllowableValues();
        if (!in_array($this->container['passwordType'], $allowedValues)) {
            return false;
        }
        return true;
    }
613883
protected function validateRun()
    {
        $status = $this->process->getExitCode();
        $error  = $this->process->getErrorOutput();

        if ($status !== 0 and $error !== '') {
            throw new \RuntimeException(
                sprintf(
                    "The exit status code %s says something went wrong:\n stderr: %s\n stdout: %s\ncommand: %s.",
                    $status,
                    $error,
                    $this->process->getOutput(),
                    $this->command
                )
            );
        }
    }
1005075
public function valid()
  {

    $allowedValues = $this->getNameAllowableValues();
    if (!in_array($this->container['name'], $allowedValues)) {
      return false;
    }
    return true;
  }
498522
public function valid()
  {

    $allowedValues = $this->getAccessLevelAllowableValues();
    if (!in_array($this->container['access_level'], $allowedValues)) {
      return false;
    }
    return true;
  }
358852
public function isAvailable()
    {
        return \file_exists($this->cacheDir) && \is_dir($this->cacheDir) && \is_writable($this->cacheDir);
    }
965923
protected function checkFileSystem() {
    $paths = [
      '%files' => 'Public files directory',
      '%private' => 'Private files directory',
      '%temp' => 'Temporary files directory',
    ];

    foreach ($paths as $key => $title) {
      if (empty($this->drushStatus['%paths'][$key])) {
        $this->logProblem(__FUNCTION__ . ":$key", "$title is not set.", 'error');

        continue;
      }

      $path = $this->drushStatus['%paths'][$key];
      if (substr($path, 0, 1) == '/') {
        $full_path = $path;
      }
      else {
        $full_path = $this->getConfigValue('docroot') . "/$path";
      }

      if (file_exists($full_path)) {
        if (!is_writable($full_path)) {
          $this->logProblem(__FUNCTION__ . ":$key", [
            "$title is not writable.",
            "",
            "Change the permissions on $full_path.",
            "Run `chmod 750 $full_path`.",
          ], 'error');
        }
      }
      else {
        $outcome = [
          "$title does not exist.",
          "",
          "Create $full_path.",
        ];

        if (in_array($key, ['%files', '%private'])) {
          $outcome[] = "Installing Drupal will create this directory for you.";
          $outcome[] = "Run `blt drupal:install` to install Drupal, or run `blt setup` to run the entire setup process.";
          $outcome[] = "Otherwise, run `mkdir -p $full_path`.";
          $outcome[] = "";
        }

        $this->logProblem(__FUNCTION__ . ":$key", $outcome, 'error');
      }

    }
  }
290711
public function valid()
    {

        $allowed_values = $this->getStateAllowableValues();
        if (!in_array($this->container['state'], $allowed_values)) {
            return false;
        }
        return true;
    }
1162518
protected function validate()
    {
        if ($this->descriptor === null || $this->scripts === null || $this->package === null) {
            throw new BuildException(
                'The deployment tool needs at least the project descriptor, '
                . 'the scripts folder and package folder to be set.'
            );
        } elseif ($this->lint !== false && $this->phpbin === null) {
            throw new BuildException('You set the lint option but not the path to the php executable.');
        }

        parent::validate();

        if ($this->lint !== false) {
            $this->arguments .= '--lint ';
        }

        if ($this->source !== null) {
            $this->arguments .= "--src-dir=$this->source ";
        }

        if ($this->output !== null) {
            $this->arguments .= "--output-dir=$this->output ";
        }

        if ($this->phpbin !== null) {
            $this->arguments .= "--php-exe=$this->phpbin ";
        }

        $this->arguments .= "--scripts-dir=$this->scripts ";
        $this->arguments .= "--package-descriptor=$this->descriptor ";
        $this->arguments .= $this->package;
    }