| Server IP : 138.197.107.151 / Your IP : 216.73.216.170 Web Server : Apache/2.4.58 (Ubuntu) System : Linux BloxBy-Builder 6.8.0-71-generic #71-Ubuntu SMP PREEMPT_DYNAMIC Tue Jul 22 16:52:38 UTC 2025 x86_64 User : wpbetasites_mrakzqskir ( 1022) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/shark-admin/vendor/psy/psysh/src/Completion/Source/ |
Upload File : |
<?php
/*
* This file is part of Psy Shell.
*
* (c) 2012-2026 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Psy\Completion\Source;
use Psy\Completion\AnalysisResult;
/**
* Completion source interface.
*
* Sources provide completion candidates for specific contexts (variables,
* methods, classes, etc.). The CompletionEngine applies fuzzy matching to
* the candidates returned by sources.
*
* Filtering Strategies:
*
* Sources use different strategies based on their candidate set size:
*
* Small sources (commands, variables, keywords):
* - Return ALL candidates regardless of prefix
* - CompletionEngine handles all filtering
*
* Large sources (classes, functions, constants):
* - If prefix matches ≥10 candidates: return prefix-filtered subset
* - Otherwise: return ALL candidates for fuzzy matching
* - Prevents overwhelming fuzzy matcher with huge sets
*
* Both strategies ensure fuzzy matching is applied consistently by the engine.
*/
interface SourceInterface
{
/**
* Check if this source applies to the given completion kinds.
*
* Uses bitwise AND to check if any of the kinds in the bitmask match.
*
* @param int $kinds Bitmask of CompletionKind constants
*/
public function appliesToKind(int $kinds): bool;
/**
* Get completion candidates for the analyzed input.
*
* Sources may use analysis->prefix for optimization but are not required
* to filter by it. CompletionEngine applies fuzzy matching to all results.
*
* @return string[] Array of completion strings
*/
public function getCompletions(AnalysisResult $analysis): array;
}