Caldera_Forms_API_Response_Factory

Created by PhpStorm.

Defined (1)

The class is defined in the following location(s).

/classes/api/response_factory.php  
  1. class Caldera_Forms_API_Response_Factory { 
  2.  
  3. public static function error_form_not_found() { 
  4. return new Caldera_Forms_API_Error( 'form-not-found', __( 'Form not found', 'caldera-forms' ) ); 
  5.  
  6. public static function error_entry_not_found() { 
  7. return new Caldera_Forms_API_Error( 'form-entry-not-found', __( 'Form entry not found', 'caldera-forms' ) ); 
  8.  
  9. public static function entry_data( $data, $total = null, $total_pages = false ) { 
  10. if( null === $total ) { 
  11. $total = count( $data ); 
  12.  
  13. $response = new Caldera_Forms_API_Response( $data, 200, array() ); 
  14. $response->set_total_header( $total ); 
  15. if ( is_numeric( $total_pages ) ) { 
  16. $response->set_total_pages_header( $total_pages ); 
  17.  
  18. return $response; 
  19.