Your project should only use iterable types in foreach loops 8

More information: https://insight.symfony.com/what-we-analyse/php.invalid_foreach_iterable

  1. }
  2. if (!empty($intent['type'])) {
  3. $response .= "**Detected Intent:** " . $intent['type'] . "\n\n";
  4. }
  5. foreach ($results['products'] as $i => $p) {
    Argument of an invalid type mixed supplied for foreach, only iterables are supported.
    Time to fix: about 9 minutes
    Read doc Permalink Copy Prompt
    Last edited by ClicShopping
  6. $response .= "**" . ($i + 1) . ". " . ($p['products_name'] ?? '') . "**\n";
  7. $response .= "💰 Price: " . ($p['products_price'] ?? 'N/A') . "€\n";
  8. $response .= "📦 Stock: " . ($p['products_quantity'] ?? 'N/A') . " units\n";
  9. $ean = $p['products_ean'] ?? '';
  • gyakutsuki

    not relevant
  1. // Display applied filters and detected intent
  2. if (!empty($intent['filters'])) {
  3. $response .= "**Applied Filters:** ";
  4. $filters = [];
  5. foreach ($intent['filters'] as $key => $value) {
    Argument of an invalid type mixed supplied for foreach, only iterables are supported.
    Time to fix: about 9 minutes
    Read doc Permalink Copy Prompt
    Last edited by ClicShopping
  6. $filters[] = "$key: $value";
  7. }
  8. $response .= implode(", ", $filters) . "\n";
  9. }
  10. if (!empty($intent['type'])) {
  • gyakutsuki

    not relevant
  1. ');
  2. $Qcategories->bindInt(':language_id', (int)$this->lang->getId());
  3. $Qcategories->execute();
  4. $categories_array = $Qcategories->fetchAll();
  5. foreach ($categories_array as $cat) {
    Argument of an invalid type mixed supplied for foreach, only iterables are supported.
    Time to fix: about 9 minutes
    Read doc Permalink Copy Prompt
    Last edited by ClicShopping
  6. $catLower = strtolower($cat['categories_name'] ?? '');
  7. if (strpos($translated, $catLower) !== false) {
  8. $intent['entities']['category'] = $catLower;
  9. $matchWeight += 0.8;
  10. $totalWeight += 1;
  • gyakutsuki

    not relevant
  1. $stopwords = [
  2. 'the', 'and', 'for', 'with', 'your', 'our', 'you', 'are', 'not', 'can', 'how', 'what', 'why', 'which', 'have', 'has', 'had', 'from', 'this', 'that', 'these', 'those', 'a', 'an', 'to', 'of', 'in', 'on', 'by', 'at', 'it', 'is', 'as', 'or', 'be', 'do', 'does', 'did', 'me', 'my', 'we', 'us', 'they', 'them', 'their', 'there', 'here', 'about', 'please', 'show', 'find', 'search', 'look', 'list', 'between', 'under', 'over', 'more', 'than', 'less', 'cheaper', 'above', 'below'
  3. ];
  4. $tokens = preg_split('/[^a-z0-9]+/i', $translated, -1, PREG_SPLIT_NO_EMPTY);
  5. foreach ($tokens as $tok) {
    Argument of an invalid type list<string>|false supplied for foreach, only iterables are supported.
    Time to fix: about 9 minutes
    Read doc Permalink Copy Prompt
    Last edited by ClicShopping
  6. $tokLower = strtolower($tok);
  7. if (strlen($tokLower) > 2 && !in_array($tokLower, $stopwords, true)) {
  8. $keywords[] = $tokLower;
  9. }
  10. }
  • gyakutsuki

    not relevant
  1. public function install()
  2. {
  3. $cut_length = \strlen('CLICSHOPPING_APP_CATEGORIES_' . $this->code . '_');
  4. foreach ($this->getParameters() as $key) {
    Argument of an invalid type mixed supplied for foreach, only iterables are supported.
    Time to fix: about 9 minutes
    Read doc Permalink Copy Prompt
    Last edited by ClicShopping
  5. $p = mb_strtolower(substr($key, $cut_length));
  6. $class = 'ClicShopping\Apps\Catalog\Categories\Module\ClicShoppingAdmin\Config\\' . $this->code . '\Params\\' . $p;
  7. $cfg = new $class($this->code);
  • gyakutsuki

    no interesting
  • gyakutsuki

    no relevant
  • gyakutsuki

    not relevant
  1. $cut = 'CLICSHOPPING_APP_CATEGORIES_' . $this->code . '_';
  2. $cut_length = \strlen($cut);
  3. foreach ($this->getParameters() as $key) {
    Argument of an invalid type mixed supplied for foreach, only iterables are supported.
    Time to fix: about 9 minutes
    Read doc Permalink Copy Prompt
    Last edited by ClicShopping
  4. $p = mb_strtolower(substr($key, $cut_length));
  5. $class = 'ClicShopping\Apps\Catalog\Categories\Module\ClicShoppingAdmin\Config\\' . $this->code . '\Params\\' . $p;
  6. $cfg = new $class($this->code);
  • gyakutsuki

    no interesting
  • gyakutsuki

    no relevant
  • gyakutsuki

    not relevant
  1. <td class="text-end"><?php echo $CLICSHOPPING_Api->getDef('text_action'); ?></td>
  2. </tr>
  3. </thead>
  4. <tbody>
  5. <?php
  6. foreach ($result as $value) {
    Argument of an invalid type mixed supplied for foreach, only iterables are supported.
    Time to fix: about 9 minutes
    Read doc Permalink Copy Prompt
    Last edited by ClicShopping
  7. ?>
  8. <tr>
  9. <td><?php echo $value['ip']; ?></td>
  10. <td><?php echo $value['comment']; ?></td>
  11. <td class="text-end">
  • gyakutsuki

    no interesting
  • gyakutsuki

    no relevant
  • gyakutsuki

    not relevant
  1. <td class="text-end"><?php echo $CLICSHOPPING_Api->getDef('text_action'); ?></td>
  2. </tr>
  3. </thead>
  4. <tbody>
  5. <?php
  6. foreach ($result as $value) {
    Argument of an invalid type mixed supplied for foreach, only iterables are supported.
    Time to fix: about 9 minutes
    Read doc Permalink Copy Prompt
    Last edited by ClicShopping
  7. ?>
  8. <tr>
  9. <td><?php echo $value['session_id']; ?></td>
  10. <td><?php echo $value['ip']; ?></td>
  11. <td><?php echo $value['date_added']; ?></td>
  • gyakutsuki

    no interesting
  • gyakutsuki

    no relevant
  • gyakutsuki

    not relevant

Your project should not contain unused code 5

More information: https://insight.symfony.com/what-we-analyse/php.unused_local_variable_or_private_member

  1. * Returns a float score between 0.0 and 1.0 based on the number of citations.
  2. *
  3. * @param string $result The AI-generated response to validate.
  4. * @return float Attribution score (0.0 to 1.0).
  5. */
  6. private static function validateAttribution(string $result): float
    Static method ClicShopping\Apps\Configuration\ChatGpt\Classes\ClicShoppingAdmin\LlmGuardrails::validateAttribution() is unused.
    Time to fix: about 15 minutes
    Read doc Permalink Copy Prompt
    Last edited by ClicShopping
  7. {
  8. $citations = substr_count($result, 'source:') + substr_count($result, '(voir') + preg_match_all('/\[.*?\]/', $result);
  9. if ($citations === 0) return 0.0;
  • gyakutsuki

    Ignored on Fri, 05 Sep 2025 19:38:33 GMT
  • gyakutsuki

    not insteresting
  • gyakutsuki

    no relevant
  1. * Implements validation heuristics, hallucination detection, and response quality assessment.
  2. */
  3. class LlmGuardrails
  4. {
  5. private const CONFIDENCE_THRESHOLD = 0.75;
  6. private const HALLUCINATION_THRESHOLD = 0.8; // a implementer
    Constant ClicShopping\Apps\Configuration\ChatGpt\Classes\ClicShoppingAdmin\LlmGuardrails::HALLUCINATION_THRESHOLD is unused.
    Time to fix: about 15 minutes
    Read doc Permalink Copy Prompt
    Last edited by ClicShopping
  7. private const MAX_RESPONSE_LENGTH = 8192;
  8. private const MIN_CONFIDENCE_SCORE = 0.6; // a implementer
  9. protected static ?SecurityLogger $securityLogger = null;
  10. // Patterns de détection d'hallucinations e-commerce
  • gyakutsuki

    Ignored on Fri, 05 Sep 2025 19:38:51 GMT
  • gyakutsuki

    not insteresting
  • gyakutsuki

    no relevant
  1. class LlmGuardrails
  2. {
  3. private const CONFIDENCE_THRESHOLD = 0.75;
  4. private const HALLUCINATION_THRESHOLD = 0.8; // a implementer
  5. private const MAX_RESPONSE_LENGTH = 8192;
  6. private const MIN_CONFIDENCE_SCORE = 0.6; // a implementer
    Constant ClicShopping\Apps\Configuration\ChatGpt\Classes\ClicShoppingAdmin\LlmGuardrails::MIN_CONFIDENCE_SCORE is unused.
    Time to fix: about 15 minutes
    Read doc Permalink Copy Prompt
    Last edited by ClicShopping
  7. protected static ?SecurityLogger $securityLogger = null;
  8. // Patterns de détection d'hallucinations e-commerce
  9. //possible to create a specific suspicious pattern
  10. private const SUSPICIOUS_PATTERNS = [];
  • gyakutsuki

    Ignored on Fri, 05 Sep 2025 19:38:37 GMT
  • gyakutsuki

    not insteresting
  • gyakutsuki

    no relevant
  1. * Logs an error message if debugging is enabled.
  2. * This function is used to log errors related to database operations.
  3. *
  4. * @param string $message The error message to log
  5. */
  6. private static function logError($message)
    Static method ClicShopping\Apps\Configuration\ChatGpt\Classes\Rag\DoctrineOrm::logError() is unused.
    Time to fix: about 15 minutes
    Read doc Permalink Copy Prompt
    Last edited by ClicShopping
  7. {
  8. if (\defined('CLICSHOPPING_APP_CHATGPT_RA_DEBUG_RAG_MANAGER') && CLICSHOPPING_APP_CHATGPT_RA_OPENAI_EMBEDDING == 'True') {
  9. error_log($message);
  10. }
  11. }
  • gyakutsuki

    Ignored on Fri, 05 Sep 2025 19:38:47 GMT
  • gyakutsuki

    not insteresting
  • gyakutsuki

    no relevant
  1. */
  2. private function createEmbeddingGenerator(): EmbeddingGeneratorInterface
  3. {
  4. return new class(Gpt::class) implements EmbeddingGeneratorInterface
  5. {
  6. private $gptClass;
    Property LLPhant\Embeddings\EmbeddingGenerator\EmbeddingGeneratorInterface@anonymous/Core/ClicShopping/Apps/Configuration/ChatGpt/Classes/Rag/MultiDBRAGManager.php:146::$gptClass is never read, only written.
    Time to fix: about 15 minutes
    Read doc Permalink Copy Prompt
    Last edited by ClicShopping
  7. /**
  8. * Constructor for the embedding generator
  9. *
  10. * @param string $gptClass Class name of the Gpt instance
  • gyakutsuki

    no relevant