It checks if a view file exists and the --force option is not present

@param CrestApp\CodeGenerator\Models\Resource $resource

@return bool
777059
protected function metRequirements(Resource $resource)
    {
        if (!$resource->hasFields()) {
            $this->error('You must provide at least one field to generate the views!');

            return false;
        }

        if (!$resource->hasPrimaryField()) {
            $this->error('None of the fields is set primary! You must assign on of the fields to be a primary field.');

            return false;
        }

        return true;
    }
370852
public function isAquired() {
        if (isset(self::$hFiles[$this->filename]))
            return is_resource(self::$hFiles[$this->filename]);
        return false;
    }
148447
private function loadImage(string $resource)
    {
        try {
            return $this->resourceLoader->load(
                    $resource,
                    function($fileName) { return ImageSource::load($fileName); }
            );
        } catch (\Throwable $t) {
            // not allowed to throw exceptions, as we are outside any catching
            // mechanism
            trigger_error(
                    'Can not load image "' . $resource . '": ' . $t->getMessage(),
                    E_USER_ERROR
            );
            return null;
        }
    }
654612
protected static function isKeyResource($resource): bool {
        if(!is_resource($resource)) {
            return FALSE;
        }
        if(get_resource_type($resource) != 'OpenSSL key') {
            return FALSE;
        }
        return TRUE;
    }
109960
public function deleteAction( $resource )
	{
		$response = $this->createAdmin( $resource )->delete( $this->getPsrRequest(), new Response() );
		return $this->setPsrResponse( $response );
	}
726847
public function deleteResource(PersistentResource $resource)
    {
        $pathAndFilename = $this->getStoragePathAndFilenameByHash($resource->getSha1());
        if (!file_exists($pathAndFilename)) {
            return true;
        }
        if (unlink($pathAndFilename) === false) {
            return false;
        }
        Files::removeEmptyDirectoriesOnPath(dirname($pathAndFilename));
        return true;
    }
76888
protected function authorizeResource($resource)
    {
        if ($this->isEditing($resource)) {
            return $this->user()->can($resource . '.update');
        }

        return $this->user()->can($resource . '.create');
    }
84122
public function isLocked($resource = null): bool
    {
        return $this->hasSharedLock($resource) || $this->hasExclusiveLock($resource);
    }
311052
public function load($resource)
    {
        if ($issue = $this->getIssue($resource)) {
            return $this->createFeature($issue);
        }

        return $this->createFeatures();
    }
154953
public function valid()
    {
        if ($this->_resource === null && $this->_filename) {
            $this->_resource = fopen($this->_filename, $this->_mode);
        }
        return !!$this->_resource && is_resource($this->_resource);
    }
43527
public function supports($resource, $type = null)
    {
        try {
            $path = $this->locator->locate($resource);
        } catch (\Exception $e) {
            return false;
        }

        return 'module' === $type && is_string($resource) && is_dir($path);
    }
999629
public function can($action, $resource = null, $resourceId = null)
    {
        $actions = (array) $action;
        $resource = $this->convertResourceToObject($resource, $resourceId);
        $permissions = $this->getPermissions();

        foreach ($actions as $action) {
            if ($aliases = $this->getAliasesForAction($action)) {
                if ($this->can($aliases, $resource) && $this->resolveRestrictions($permissions, $action, $resource)) {
                    return true;
                }
            }

            if (! $this->resolvePermissions($action, $resource)) {
                return false;
            }
        }

        return true;
    }
450750
public static boolean isFile(Resource resource) {
        return resource.isResourceType(ResourceUtil.TYPE_FILE) ||
                resource.isResourceType(ResourceUtil.TYPE_LINKED_FILE);
    }
26752
public function tryResourceAssignation(DomainResource $resource)
    {
        if ($type = $this->matchType($resource)) {
            $this->resources[$type] = $resource;

            return true;
        }

        return false;
    }
421373
public function checkAccess($action, $resource)
    {
        if ((is_null($resource) || is_null($resource->getId())) && (empty($action) || in_array(strtolower($action), array('list', 'create', 'post')))) {
            return true;
        }

        if (!is_null($resource)) {
            $query = $this->createQueryBuilder();
            $query->andWhere($query->getRootAliases()[0] . '.id = ' . $this->addNamedParameter('id', $resource, $query));
            $result = $this->getOneOrNullResultFromQueryBuilder($query);
            if ($result) {
                return true;
            } else {
                $this->throwException('Access for this resource has been denied', 'access-denied');
            }
        }
    }
947131
public function hasSharedLock($resource = null): bool
    {
        if (null !== $resource) {
            return isset($this->sharedLock[$this->getResourceId($resource)]);
        }

        return !empty($this->sharedLock);
    }
196204
protected function matchesResource(Resource $resource = null)
    {
        // If the resource is null we should only return true if the current resource is also null.
        if ($resource === null) {
            return $this->getResource() === null || (
                $this->getResourceType() === null && $this->getResourceId() === null
            );
        }

        // If the permission's resource id is null then all resources with a specific ID are accepted.
        if ($this->getResourceId() === null) {
            return $this->getResourceType() === $resource->getResourceType();
        }

        // Otherwise make sure that we're matching a specific resource.
        return (
            $this->getResourceType() === $resource->getResourceType() &&
            $this->getResourceId() === $resource->getResourceId()
        );
    }