Filters whether the current image is displayable in the browser. (https://core.trac.wordpress.org/browser/tags/4.8/src/wp-admin/includes/image.php#L558)

@param bool $result
@param string $path

@return bool
554763
public function fileIsDisplayableImage($result, $path) {
		$mime = wp_get_image_mime($path);
		if(!$mime) {
			$ftype = wp_check_filetype($path);
			if(!empty($ftype) && isset($ftype['type'])) {
				$mime = $ftype['type'];
			}

			$ext = pathinfo($path, PATHINFO_EXTENSION);
			if(('ai' == strtolower($ext)) && ("application/pdf" == $mime)) {
				return true;
			}
		}

		if($mime == 'application/vnd.adobe.illustrator') {
			return true;
		}

		if($mime == 'image/tiff') {
			return true;
		}

		if($mime == 'image/psd') {
			return true;
		}

		return $result;
	}
964565
public function isStored($path, $filter, $resolver = null)
    {
        return $this->getResolver($filter, $resolver)->isStored($path, $filter);
    }
675072
public function getUrlOfFilteredImage($path, $filter, $resolver = null)
    {
        if ($this->cacheManager->isStored($path, $filter, $resolver)) {
            return $this->cacheManager->resolve($path, $filter, $resolver);
        }

        $filteredBinary = $this->createFilteredBinary(
            $path,
            $filter
        );

        $this->cacheManager->store(
            $filteredBinary,
            $path,
            $filter,
            $resolver
        );

        return $this->cacheManager->resolve($path, $filter, $resolver);
    }
471949
public static function resolvePageByPath($handle, $path = false)
    {
        return Symphony::Database()->fetchRow(0, sprintf(
            "SELECT * FROM `tbl_pages` WHERE `path` %s AND `handle` = '%s' LIMIT 1",
            ($path ? " = '".Symphony::Database()->cleanValue($path)."'" : 'IS NULL'),
            Symphony::Database()->cleanValue($handle)
        ));
    }
37852
protected function parseResult($result) {
 
        if (! property_exists($result, 'return')) {
            return [];
        }

        $result = $result->return;
        
        if (is_null($result)) {
            return [];
        }
        
        if (!is_array($result)) {
            $result = [$result];
        }

        return $this->filterResult($result);
    }
41065
private function matchesPathAny($result, array $acceptor)
    {
        if (!($result instanceof ResultInterface)) {
            return false;
        }

        $actuals = $result->search($acceptor['argument']) ?: [];
        return in_array($acceptor['expected'], $actuals);
    }
235864
public function legacyResultHasLayout(ezpKernelResult $result)
    {
        return
            isset($result->getAttribute('module_result')['pagelayout'])
            || $this->requestStack->getMasterRequest()->attributes->get('_route') === '_ezpublishLegacyLayoutSet';
    }
47980
private function matchesPath($result, array $acceptor)
    {
        return !($result instanceof ResultInterface)
            ? false
            : $acceptor['expected'] == $result->search($acceptor['argument']);
    }
123755
public function renderOnSuccess($result, SilexKernel $silexKernel)
    {
        if (is_object($result) && method_exists($result, '__toString')) {
            $result = (string)$result;
        }
        elseif (is_bool($result)) {
            $result = $result ? "true" : "false";
        }
        elseif (is_scalar($result)) {
            $result = (string)$result;
        }
        elseif (is_array($result)) {
            $result = nl2br(str_replace(' ', '&nbsp;', json_encode($result, JSON_PRETTY_PRINT)));
        }
        elseif (!is_string($result)) {
            return $this->renderOnException(
                new WrappedExceptionInfo(
                    new \RuntimeException("Unsupported type of result: " . print_r($result, true)),
                    Response::HTTP_INTERNAL_SERVER_ERROR
                ),
                $silexKernel
            );
        }
        
        return new Response($result);
    }
1101306
public function filter($path, $filter, array $config = [], $resolver = null)
    {
        return $this->cache->getBrowserPath(parse_url($path, PHP_URL_PATH), $filter, $config, $resolver);
    }
642299
public function resolve($path, $filter, $resolver = null)
    {
        if (false !== mb_strpos($path, '/../') || 0 === mb_strpos($path, '../')) {
            throw new NotFoundHttpException(sprintf("Source image was searched with '%s' outside of the defined root path", $path));
        }

        $preEvent = new CacheResolveEvent($path, $filter);
        $this->dispatcher->dispatch(ImagineEvents::PRE_RESOLVE, $preEvent);

        $url = $this->getResolver($preEvent->getFilter(), $resolver)->resolve($preEvent->getPath(), $preEvent->getFilter());

        $postEvent = new CacheResolveEvent($preEvent->getPath(), $preEvent->getFilter(), $url);
        $this->dispatcher->dispatch(ImagineEvents::POST_RESOLVE, $postEvent);

        return $postEvent->getUrl();
    }
448754
protected function response($result)
    {
        $response = $this->container->get(Application::RESPONSE);

        if ($result instanceof ResponseInterface)
        {
            return $result;
        }

        $response->stream()->write($result);

        return $response;
    }
802993
public static function isEmpty($input, $result = true)
    {
        if (is_array($input) && count($input)) {
            foreach ($input as $value) {
                $result = $result && self::isEmpty($value);
            }

            return $result;
        }

        return empty($input);
    }
521807
public function onResult(\pq\Result $result = null) {
		if ($result && $result->status != \pq\Result::TUPLES_OK) {
			return $result;
		}
		
		$rowset = $this->getRowsetPrototype();
		if (is_callable($rowset)) {
			return $rowset($result);
		} elseif ($rowset) {
			return new $rowset($this, $result);
		}
		
		return $result;
	}
204708
protected function collectionFromResult($result)
    {
        // If we have one result which is not an assoc array, make it the first element of an array for the
        // collectionFromResult function so we always return a collection from filter
        if ((bool) count(array_filter(array_keys($result), 'is_string'))) {
            $result = [$result];
        }

        $class = $this->class;
        $collection = [];

        foreach ($result as $r) {
            $collection[] = new $class($this->connection, $r);
        }

        return $collection;
    }
699479
public static function isResultSuccessful(array $result): bool
    {
        assert(
            count($result) === 2 &&
            ($result[static::REPLY_ERRORS_INFO] === null || is_array($result[static::REPLY_ERRORS_INFO]) === true)
        );

        // if error code is `null`
        $isOk = $result[static::REPLY_ERRORS_INFO] === null;

        return $isOk;
    }
1269615
public function compare($selected, $result)
    {
        $compare = array_intersect($selected, $result);

        return ($compare == $selected ? true : false);
    }