macder /
wfv-validation
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | defined( 'ABSPATH' ) || die(); |
||
| 3 | /* |
||
| 4 | Plugin Name: WFV - Form Validation |
||
| 5 | Plugin URI: https://macder.github.io/wfv/ |
||
| 6 | Description: A simple fluid and concise API to manage user input, validation, feedback, and safe output. |
||
| 7 | Version: 0.11.3 |
||
| 8 | Author: Maciej Derulski |
||
| 9 | Author URI: https://github.com/macder |
||
| 10 | License: BSD 3-Clause |
||
| 11 | License URI: https://github.com/macder/wfv-validation/blob/master/LICENSE |
||
| 12 | */ |
||
| 13 | |||
| 14 | define( 'WFV_VALIDATE_VERSION', '0.11.3' ); |
||
| 15 | define( 'WFV_VALIDATE__MINIMUM_WP_VERSION', '3.7' ); |
||
| 16 | define( 'WFV_VALIDATE__PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); |
||
| 17 | |||
| 18 | require_once WFV_VALIDATE__PLUGIN_DIR . '/vendor/autoload.php'; |
||
| 19 | |||
| 20 | use WFV\FormComposite; |
||
| 21 | use WFV\RuleFactory; |
||
| 22 | use WFV\Validator; |
||
| 23 | use WFV\Artisan\Director; |
||
| 24 | use WFV\Artisan\FormArtisan; |
||
| 25 | use WFV\Collection\MessageCollection; |
||
| 26 | |||
| 27 | /** |
||
| 28 | * |
||
| 29 | * |
||
| 30 | * @since 0.10.0 |
||
| 31 | * |
||
| 32 | * @param string $action |
||
| 33 | * @param array $form Form arguments |
||
| 34 | * @param bool $trim Trim whitespace from beginning and end of string |
||
| 35 | */ |
||
| 36 | function wfv_create( $action, array &$form, $trim = true ) { |
||
|
0 ignored issues
–
show
|
|||
| 37 | $messages = new MessageCollection( $form ); |
||
| 38 | |||
| 39 | $builder = new FormArtisan( $form, $action ); |
||
| 40 | $form = ( new Director() ) |
||
| 41 | ->with( 'input' ) |
||
| 42 | ->with( 'rules' ) |
||
| 43 | ->with( 'errors' ) |
||
| 44 | ->compose( $builder ); |
||
| 45 | |||
| 46 | if( $form->input()->is_populated() ) { |
||
| 47 | ( new Validator( new RuleFactory(), $messages ) )->validate( $form ); |
||
| 48 | } |
||
| 49 | } |
||
| 50 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.