$newTagIds set to false by Set::extract causing array_merge to halt while in debug

If $newTagIds come back as an empty array, there is no checking before
the $newTagIds = Set::extract($newTagIds, '{n}.Tagged.tag_id'); which
will return a false causing execution to halt when debug mode is set to
2.

I updated the code the check $newTagIds for empty before allowing the
Set::extract to happen so if it is empty, it will pass an array() to
the array_merge and not throw a warning.

I also cleaned up some minor coding standard issues.