Code Duplication    Length = 12-14 lines in 2 locations

src/Post/PostType.php 1 location

@@ 148-161 (lines=14) @@
145
     *
146
     * @return $this
147
     */
148
    public function unregister()
149
    {
150
        if (! static::exists($this->slug)) {
151
            throw new NonExistentPostTypeException("No post type exists with name '{$this->slug}'.");
152
        }
153
154
        $result = unregister_post_type($this->slug);
155
156
        if (is_wp_error($result)) {
157
            throw new WP_ErrorException($result);
158
        }
159
160
        return $this;
161
    }
162
163
    /**
164
     * Magic Getter.

src/Taxonomy/Taxonomy.php 1 location

@@ 116-127 (lines=12) @@
113
     *
114
     * @return $this
115
     */
116
    public function unregister()
117
    {
118
        if (! static::exists($this->taxonomy->name)) {
119
            throw new Exception\NonExistentTaxonomyException;
120
        }
121
122
        if (is_wp_error($error = unregister_taxonomy($this->taxonomy->name))) {
123
            throw new WP_ErrorException($error);
124
        }
125
126
        return $this;
127
    }
128
129
    /**
130
     * Magic Getter.