Code Duplication    Length = 18-18 lines in 4 locations

src/app/Balloon.App.Convert/AttributeDecorator.php 1 location

@@ 114-131 (lines=18) @@
111
    /**
112
     * Execute closures.
113
     */
114
    protected function translateAttributes(array $slave, array $attributes): array
115
    {
116
        foreach ($attributes as $key => &$value) {
117
            if ($value instanceof Closure) {
118
                $result = $value->call($this, $slave);
119
120
                if (null === $result) {
121
                    unset($attributes[$key]);
122
                } else {
123
                    $value = $result;
124
                }
125
            } elseif ($value === null) {
126
                unset($attributes[$key]);
127
            }
128
        }
129
130
        return $attributes;
131
    }
132
}
133

src/lib/Filesystem/DeltaAttributeDecorator.php 1 location

@@ 71-88 (lines=18) @@
68
    /**
69
     * Execute closures.
70
     */
71
    protected function translateAttributes(array $node, array $attributes): array
72
    {
73
        foreach ($attributes as $key => &$value) {
74
            if ($value instanceof Closure) {
75
                $result = $value->call($this, $node);
76
77
                if (null === $result) {
78
                    unset($attributes[$key]);
79
                } else {
80
                    $value = $result;
81
                }
82
            } elseif ($value === null) {
83
                unset($attributes[$key]);
84
            }
85
        }
86
87
        return $attributes;
88
    }
89
}
90

src/app/Balloon.App.Notification/AttributeDecorator.php 1 location

@@ 130-147 (lines=18) @@
127
    /**
128
     * Execute closures.
129
     */
130
    protected function translateAttributes(array $message, array $attributes): array
131
    {
132
        foreach ($attributes as $key => &$value) {
133
            if ($value instanceof Closure) {
134
                $result = $value->call($this, $message);
135
136
                if (null === $result) {
137
                    unset($attributes[$key]);
138
                } else {
139
                    $value = $result;
140
                }
141
            } elseif ($value === null) {
142
                unset($attributes[$key]);
143
            }
144
        }
145
146
        return $attributes;
147
    }
148
}
149

src/lib/Filesystem/Node/AttributeDecorator.php 1 location

@@ 310-327 (lines=18) @@
307
    /**
308
     * Execute closures.
309
     */
310
    protected function translateAttributes(NodeInterface $node, array $attributes): array
311
    {
312
        foreach ($attributes as $key => &$value) {
313
            if ($value instanceof Closure) {
314
                $result = $value->call($this, $node);
315
316
                if (null === $result) {
317
                    unset($attributes[$key]);
318
                } else {
319
                    $value = $result;
320
                }
321
            } elseif ($value === null) {
322
                unset($attributes[$key]);
323
            }
324
        }
325
326
        return $attributes;
327
    }
328
}
329