1 | <?php |
||
25 | abstract class JobHandlerFile extends JobHandler { |
||
26 | /** |
||
27 | * |
||
28 | * @var EEHI_File |
||
29 | */ |
||
30 | protected $_file_helper = null; |
||
31 | const temp_folder_name = 'batch_temp_folder'; |
||
32 | public function __construct( EEHI_File $file_helper = null ) { |
||
37 | |||
38 | |||
39 | |||
40 | /** |
||
41 | * Creates a file |
||
42 | * |
||
43 | * @param string $job_id |
||
44 | * @param string $filename |
||
45 | * @return string |
||
46 | * @throws BatchRequestException |
||
47 | */ |
||
48 | public function create_file_from_job_with_name( $job_id, $filename ) { |
||
49 | $filepath = ''; |
||
50 | try{ |
||
51 | $success = $this->_file_helper->ensure_folder_exists_and_is_writable( |
||
52 | EVENT_ESPRESSO_UPLOAD_DIR . JobHandlerFile::temp_folder_name |
||
53 | ); |
||
54 | if ( $success ) { |
||
55 | $success = $this->_file_helper->ensure_folder_exists_and_is_writable( |
||
56 | EVENT_ESPRESSO_UPLOAD_DIR . JobHandlerFile::temp_folder_name . DS . $job_id |
||
57 | ); |
||
58 | } |
||
59 | if( $success ) { |
||
60 | $filepath = EVENT_ESPRESSO_UPLOAD_DIR . JobHandlerFile::temp_folder_name . DS . $job_id . DS. $filename; |
||
61 | $success = $this->_file_helper->ensure_file_exists_and_is_writable( $filepath ); |
||
62 | } |
||
63 | //those methods normally fail with an exception, but if not, let's do it |
||
64 | if( ! $success ) { |
||
65 | throw new \EE_Error( 'could_not_create_temp_file', |
||
66 | __( 'An unknown error occurred', 'event_espresso' )); |
||
67 | } |
||
68 | } catch( \EE_Error $e ) { |
||
69 | throw new BatchRequestException( |
||
70 | sprintf( |
||
71 | __( 'Could not create temporary file for job %1$s, because: %2$s ', 'event_espresso' ), |
||
72 | $job_id, |
||
73 | $e->getMessage() |
||
74 | ), |
||
75 | 500, |
||
76 | $e |
||
77 | ); |
||
78 | } |
||
79 | return $filepath; |
||
80 | } |
||
81 | |||
82 | /** |
||
83 | * Gets the URL to download the file |
||
84 | * @param string $filepath |
||
85 | * @return string url to file |
||
86 | */ |
||
87 | public function get_url_to_file( $filepath ) { |
||
90 | } |
||
91 | |||
92 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..