Code Duplication    Length = 3-3 lines in 4 locations

core/db_models/strategies/EE_Restriction_Generator_Base.strategy.php 1 location

@@ 68-70 (lines=3) @@
65
	 * @return EEM_Base | EEM_Soft_Delete_Base
66
	 */
67
	public function model() {
68
		if( ! $this->_model instanceof EEM_Base ) {
69
			throw new EE_Error( sprintf( __( 'Cannot generate capability restrictions because model has not yet been set on the %s. Please ensure _construct_finalize() was called', 'event_espresso' ), get_class( $this ) ) );
70
		}
71
		return $this->_model;
72
	}
73

core/libraries/form_sections/base/EE_Model_Form_Section.form.php 2 locations

@@ 43-45 (lines=3) @@
40
        if (isset($options_array['model']) && $options_array['model'] instanceof EEM_Base) {
41
            $this->_model = $options_array['model'];
42
        }
43
        if (! $this->_model || ! $this->_model instanceof EEM_Base) {
44
            throw new EE_Error(sprintf(__("Model Form Sections must first specify the _model property to be a subclass of EEM_Base",
45
                "event_espresso")));
46
        }
47
        if (isset($options_array['subsection_args'])) {
48
            $subsection_args = $options_array['subsection_args'];
@@ 347-349 (lines=3) @@
344
     */
345
    public function save()
346
    {
347
        if (! $this->_model_object) {
348
            throw new EE_Error(sprintf(__("Cannot save the model form's model object (model is '%s') because there is no model object set. You must either set it, or call receive_form_submission where it is set automatically",
349
                "event_espresso"), get_class($this->_model)));
350
        }
351
        //ok so the model object is set. Just set it with the submitted form data
352
        foreach ($this->inputs_values_corresponding_to_model_fields() as $field_name => $field_value) {

core/EE_Capabilities.core.php 1 location

@@ 1123-1125 (lines=3) @@
1120
        //error proof if the name has EEM in it
1121
        $this->_model_name = str_replace('EEM', '', $this->_model_name);
1122
        $this->_model = EE_Registry::instance()->load_model($this->_model_name);
1123
        if (! $this->_model instanceof EEM_Base) {
1124
            throw new EE_Error(
1125
                sprintf(
1126
                    __(
1127
                        'This string passed in to %s to represent a EEM_Base model class was not able to be used to instantiate the class.   Please ensure that the string is a match for the EEM_Base model name (not including the EEM_ part). This was given: %s',
1128
                        'event_espresso'