url ) || empty( $this->token ) ) { throw new Action_Exception( 'invalid_api_key' ); } parent::run(); } /** * Convert legacy properties. * Custom properties converting in * \JFB_Modules\Active_Campaign\Methods\Custom_Contact_Property * * @param array $fields_map * @param bool $revert * * @return Abstract_Modifier|Contact_Modifier */ public function set_fields_map( array $fields_map, bool $revert = false ): Abstract_Modifier { parent::set_fields_map( $fields_map, $revert ); $legacy = array( 'first_name' => 'firstName', 'last_name' => 'lastName', ); foreach ( $this->fields_map as $field_name => $property ) { if ( ! isset( $legacy[ $property ] ) ) { continue; } $this->fields_map[ $field_name ] = $legacy[ $property ]; } return $this; } public function set_api_key( string $token ): self { $this->token = $token; return $this; } public function set_api_url( string $url ): self { $this->url = $url; return $this; } }