$line) { if (preg_match('/\bclass\s+' . preg_quote($class_name) . '\b/', $line)) { $class_line = $i + 1; break; } } $this->add_violation( $file_path, $class_line, "Model {$class_name} is missing protected \$table property", $lines[$class_line - 1] ?? '', "Add: protected \$table = 'table_name';", 'high' ); } else { // Check if table name is not empty $table_name = $match[1]; if (empty($table_name)) { // Lines already split above $line_number = 1; foreach ($lines as $i => $line) { if (preg_match('/protected\s+\$table/', $line)) { $line_number = $i + 1; break; } } $this->add_violation( $file_path, $line_number, "Model {$class_name} has empty \$table property", $lines[$line_number - 1] ?? '', 'Set $table to the appropriate database table name', 'high' ); } } } }