for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* @since 2.03.05
*/
class FrmFieldOption {
* @var string|int
*
protected $option_key;
* @var string|array
protected $option;
* @var string
protected $saved_value = '';
protected $option_label = '';
public function __construct( $option_key, $option, $args = array() ) {
$args
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.
$this->option_key = $option_key;
$this->option = $option;
$this->set_option_label();
$this->set_saved_value();
}
* Set the option label
private function set_option_label() {
if ( is_array( $this->option ) ) {
$this->option_label = ( isset( $this->option['label'] ) ? $this->option['label'] : reset( $this->option ) );
} else {
$this->option_label = $this->option;
* Set the saved value
protected function set_saved_value() {
$this->saved_value = $this->option_label;
* Print a single option
* @param string $selected_value
* @param int $truncate
public function print_single_option( $selected_value, $truncate ) {
echo '<option value="' . esc_attr( $this->saved_value ) . '"';
selected( esc_attr( $selected_value ), esc_attr( $this->saved_value ) );
// TODO: add hook that can add attributes to option text
echo '>';
echo FrmAppHelper::truncate( $this->option_label, $truncate ) . '</option>';
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.