Skip to content

Latest commit

 

History

History
81 lines (61 loc) · 7.55 KB

entityFilterCondition.md

File metadata and controls

81 lines (61 loc) · 7.55 KB

BumbleDocGen / Technical description of the project / Parser / Entity filter conditions


Entity filter conditions

Filters serve as a foundational mechanism within our documentation generator, dictating which segments of the source code are selected during the initial parsing phase. These rules facilitate a strategic extraction of elements, such as classes, methods, or constants, from the underlying codebase. By implementing these filters, users are endowed with the capability to customize the documentation output, ensuring that it precisely aligns with their requirements and expectations. This level of granularity not only streamlines the documentation process but also guarantees that the resultant documents are devoid of superfluous details, focusing solely on pertinent information.

All filter conditions implement the ConditionInterface interface.

Mechanism for adding entities to the collection

For each language handler, according to the configuration, the following scheme is applicable:

flowchart LR
 Start((Start)) --> Parse(Starting the file parsing process)
 Parse --> NextFileExists{Have \nthe next \nfile to \nprocess?}
 NextFileExists -- Yes --> EntityCheck{Does the file \ncontain an \nentity?}
 NextFileExists -- No --> Exit(((Exit)))
 EntityCheck -- Yes --> FilterCheck{Can the found entity \nbe added \naccording to the \nfilters condition?}
 EntityCheck -- No --> NextFileExists
 FilterCheck -- Yes --> AddEntity(Adding an entity to a collection)
 FilterCheck -- No --> NextFileExists
 AddEntity --> NextFileExists

 style FilterCheck color:red
Loading

The diagram shows the mechanism for adding root entities, but this also applies to the attributes of each entity, for example, for PHP there are rules for checking the possibility of adding methods, properties and constants.

Filter conditions configuration

Filter conditions are configured separately for language handlers.

This is an example configuration for PHP, and here you can see the use of configuration conditions in a real configuration BumbleDocGen/LanguageHandler/Php/phpHandlerDefaultSettings.yaml:

language_handlers:
  php:
    class: \BumbleDocGen\LanguageHandler\Php\PhpHandler
    settings:
        class_filter:
            class: \BumbleDocGen\Core\Parser\FilterCondition\CommonFilterCondition\TrueCondition
        class_constant_filter:
            class: \BumbleDocGen\LanguageHandler\Php\Parser\FilterCondition\ClassConstantFilterCondition\VisibilityCondition
            arguments:
              - public
              - protected
        method_filter:
            class: \BumbleDocGen\Core\Parser\FilterCondition\ConditionGroup
            arguments:
               - and
               - class: \BumbleDocGen\LanguageHandler\Php\Parser\FilterCondition\MethodFilterCondition\IsPublicCondition
               - class: \BumbleDocGen\LanguageHandler\Php\Parser\FilterCondition\MethodFilterCondition\OnlyFromCurrentClassCondition
        property_filter:
            class: \BumbleDocGen\Core\Parser\FilterCondition\ConditionGroup
            arguments:
               - and
               - class: \BumbleDocGen\LanguageHandler\Php\Parser\FilterCondition\PropertyFilterCondition\IsPublicCondition
               - class: \BumbleDocGen\LanguageHandler\Php\Parser\FilterCondition\PropertyFilterCondition\OnlyFromCurrentClassCondition

Available filters

Common filtering conditions that are available for any entity:

  • FalseCondition - False conditions, any object is not available
  • FileTextContainsCondition - Checking if a file contains a substring
  • LocatedInCondition - Checking the existence of an entity in the specified directories
  • LocatedNotInCondition - Checking the existence of an entity not in the specified directories
  • TrueCondition - True conditions, any object is available
  • ConditionGroup - Filter condition to group other filter conditions. A group can have an OR/AND condition test; In the case of OR, it is enough to successfully check at least one condition, in the case of AND, all checks must be successfully completed.

Filter condition for working with entities PHP language handler:

Group nameClass short nameDescription
ClassConstantFilterConditionIsPrivateConditionCheck is a private constant or not
IsProtectedConditionCheck is a protected constant or not
IsPublicConditionCheck is a public constant or not
VisibilityConditionConstant access modifier check
MethodFilterConditionIsPrivateConditionCheck is a private method or not
IsProtectedConditionCheck is a protected method or not
IsPublicConditionCheck is a public method or not
OnlyFromCurrentClassConditionOnly methods that belong to the current class (not parent)
VisibilityConditionMethod access modifier check
PropertyFilterConditionIsPrivateConditionCheck is a private property or not
IsProtectedConditionCheck is a protected property or not
IsPublicConditionCheck is a public property or not
OnlyFromCurrentClassConditionOnly properties that belong to the current class (not parent)
VisibilityConditionProperty access modifier check


Last page committer: fshcherbanich <[email protected]>
Last modified date: Sat Oct 28 11:03:31 2023 +0300
Page content update date: Mon Nov 06 2023
Made with Bumble Documentation Generator